jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r478973 - in /jackrabbit/branches/1.1/jackrabbit/src: main/java/org/apache/jackrabbit/util/ISO9075.java test/java/org/apache/jackrabbit/util/ISO9075Test.java
Date Fri, 24 Nov 2006 20:05:09 GMT
Author: jukka
Date: Fri Nov 24 12:05:07 2006
New Revision: 478973

URL: http://svn.apache.org/viewvc?view=rev&rev=478973
Log:
1.1: Merged revision 454417 (JCR-563)

Modified:
    jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/util/ISO9075.java
    jackrabbit/branches/1.1/jackrabbit/src/test/java/org/apache/jackrabbit/util/ISO9075Test.java

Modified: jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/util/ISO9075.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/util/ISO9075.java?view=diff&rev=478973&r1=478972&r2=478973
==============================================================================
--- jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/util/ISO9075.java
(original)
+++ jackrabbit/branches/1.1/jackrabbit/src/main/java/org/apache/jackrabbit/util/ISO9075.java
Fri Nov 24 12:05:07 2006
@@ -134,7 +134,12 @@
         StringBuffer decoded = new StringBuffer();
         Matcher m = ENCODE_PATTERN.matcher(name);
         while (m.find()) {
-            m.appendReplacement(decoded, Character.toString((char) Integer.parseInt(m.group().substring(2,
6), 16)));
+            char ch = (char) Integer.parseInt(m.group().substring(2, 6), 16);
+            if (ch == '$' || ch == '\\') {
+                m.appendReplacement(decoded, "\\" + ch);
+            } else {
+                m.appendReplacement(decoded, Character.toString(ch));
+            }
         }
         m.appendTail(decoded);
         return decoded.toString();

Modified: jackrabbit/branches/1.1/jackrabbit/src/test/java/org/apache/jackrabbit/util/ISO9075Test.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.1/jackrabbit/src/test/java/org/apache/jackrabbit/util/ISO9075Test.java?view=diff&rev=478973&r1=478972&r2=478973
==============================================================================
--- jackrabbit/branches/1.1/jackrabbit/src/test/java/org/apache/jackrabbit/util/ISO9075Test.java
(original)
+++ jackrabbit/branches/1.1/jackrabbit/src/test/java/org/apache/jackrabbit/util/ISO9075Test.java
Fri Nov 24 12:05:07 2006
@@ -37,6 +37,21 @@
         assertEquals("My_x005f_x0020_x0020_Documents", ISO9075.encode("My_x0020 Documents"));
     }
 
+    public void testMatcherEscapes() {
+        assertEquals(
+                "StringWith$inside", ISO9075.decode("StringWith$inside"));
+        assertEquals(
+                "StringWith$inside", ISO9075.decode("StringWith_x0024_inside"));
+        assertEquals(
+                "StringWith_x0024_inside", ISO9075.encode("StringWith$inside"));
+        assertEquals(
+                "StringWith\\inside", ISO9075.decode("StringWith\\inside"));
+        assertEquals(
+                "StringWith\\inside", ISO9075.decode("StringWith_x005c_inside"));
+        assertEquals(
+                "StringWith_x005c_inside", ISO9075.encode("StringWith\\inside"));
+    }
+
     /**
      * This is a disabled brute force test. It tests permutations of characters:
      * <code>' ', '_', 'x', '0', '2', 'a', 'b', '{'</code>, encodes and decodes



Mime
View raw message