commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r620149 - in /commons/proper/configuration/branches/configuration2_experimental/src: main/java/org/apache/commons/configuration2/INIConfiguration.java test/java/org/apache/commons/configuration2/TestINIConfiguration.java
Date Sat, 09 Feb 2008 16:41:43 GMT
Author: oheger
Date: Sat Feb  9 08:41:43 2008
New Revision: 620149

URL: http://svn.apache.org/viewvc?rev=620149&view=rev
Log: (empty)

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java?rev=620149&r1=620148&r2=620149&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
Sat Feb  9 08:41:43 2008
@@ -400,7 +400,12 @@
             i++;
         }
 
-        return result.toString().trim();
+        String v = result.toString();
+        if(!quoted)
+        {
+            v = v.trim();
+        }
+        return v;
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java?rev=620149&r1=620148&r2=620149&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java
Sat Feb  9 08:41:43 2008
@@ -213,4 +213,28 @@
 
         assertEquals("value", "1;2;3", config2.getString("section.key1"));
     }
+
+    /**
+     * Tests whether whitespace is left unchanged for quoted values.
+     */
+    public void testQuotedValueWithWhitespace() throws Exception
+    {
+        final String content = "CmdPrompt = \" [test@cmd ~]$ \"";
+        INIConfiguration config = new INIConfiguration();
+        config.load(new StringReader(content));
+        assertEquals("Wrong propert value", " [test@cmd ~]$ ", config
+                .getString("CmdPrompt"));
+    }
+
+    /**
+     * Tests a quoted value with space and a comment.
+     */
+    public void testQuotedValueWithWhitespaceAndComment() throws Exception
+    {
+        final String content = "CmdPrompt = \" [test@cmd ~]$ \" ; a comment";
+        INIConfiguration config = new INIConfiguration();
+        config.load(new StringReader(content));
+        assertEquals("Wrong propert value", " [test@cmd ~]$ ", config
+                .getString("CmdPrompt"));
+    }
 }



Mime
View raw message