You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by eb...@apache.org on 2005/10/10 19:22:13 UTC

svn commit: r312690 - in /jakarta/commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/PropertiesConfiguration.java src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java xdocs/changes.xml

Author: ebourg
Date: Mon Oct 10 10:22:05 2005
New Revision: 312690

URL: http://svn.apache.org/viewcvs?rev=312690&view=rev
Log:
PropertiesConfiguration now translates properly the escaped unicode characters (like \u1234) used in the property keys (Bug 36991)

Modified:
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
    jakarta/commons/proper/configuration/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java?rev=312690&r1=312689&r2=312690&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java Mon Oct 10 10:22:05 2005
@@ -347,7 +347,7 @@
                 }
                 else
                 {
-                    addProperty(key, unescapeJava(value, getDelimiter()));
+                    addProperty(StringEscapeUtils.unescapeJava(key), unescapeJava(value, getDelimiter()));
                 }
 
             }

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java?rev=312690&r1=312689&r2=312690&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java Mon Oct 10 10:22:05 2005
@@ -1,5 +1,3 @@
-package org.apache.commons.configuration;
-
 /*
  * Copyright 2001-2005 The Apache Software Foundation.
  *
@@ -16,16 +14,12 @@
  * limitations under the License.
  */
 
+package org.apache.commons.configuration;
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.PrintWriter;
-import java.io.PipedOutputStream;
-import java.io.PipedInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.FileInputStream;
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -309,6 +303,14 @@
     public void testUnescapeJava()
     {
         assertEquals("test\\,test", PropertiesConfiguration.unescapeJava("test\\,test", ','));
+    }
+
+    public void testEscapedKey() throws Exception
+    {
+        PropertiesConfiguration conf = new PropertiesConfiguration();
+        conf.load(new StringReader("\\u0066\\u006f\\u006f=bar"));
+
+        assertEquals("value of the 'foo' property", "bar", conf.getString("foo"));
     }
 
     public void testMixedArray()

Modified: jakarta/commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/xdocs/changes.xml?rev=312690&r1=312689&r2=312690&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/configuration/trunk/xdocs/changes.xml Mon Oct 10 10:22:05 2005
@@ -23,6 +23,11 @@
   <body>
 
     <release version="1.2-dev" date="in SVN">
+      <action dev="ebourg" type="update" issue="36991">
+        PropertiesConfiguration now translates properly the escaped unicode
+        characters (like \u1234) used in the property keys. This complies with
+        the specification of java.util.Properties.
+      </action>
       <action dev="ebourg" type="update" issue="36784">
         ConfigurationConverter.getProperties() now uses the delimiter of the
         specified configuration to convert the list properties into strings.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org