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 2007/04/23 11:39:33 UTC

svn commit: r531399 - in /jakarta/commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/INIConfiguration.java xdocs/changes.xml

Author: ebourg
Date: Mon Apr 23 02:39:29 2007
New Revision: 531399

URL: http://svn.apache.org/viewvc?view=rev&rev=531399
Log:
Output flushing in INIConfiguration (CONFIGURATION-267)
OS specific line separator in INIConfiguration

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

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/INIConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/INIConfiguration.java?view=diff&rev=531399&r1=531398&r2=531399
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/INIConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/INIConfiguration.java Mon Apr 23 02:39:29 2007
@@ -173,9 +173,6 @@
      */
     protected static final String SEPARATOR_CHARS = "=:";
 
-    /** Constant for the used line separator.*/
-    private static final String LINE_SEPARATOR = "\r\n";
-
     /**
      * Create a new empty INI Configuration.
      */
@@ -227,29 +224,31 @@
     public void save(Writer writer) throws ConfigurationException
     {
         PrintWriter pw = new PrintWriter(writer);
-        Iterator iter = this.getSections().iterator();
-        while (iter.hasNext())
+        Iterator it = getSections().iterator();
+        while (it.hasNext())
         {
-            String section = (String) iter.next();
+            String section = (String) it.next();
             pw.print("[");
             pw.print(section);
             pw.print("]");
-            pw.print(LINE_SEPARATOR);
+            pw.println();
 
-            Configuration values = this.subset(section);
-            Iterator iterator = values.getKeys();
-            while (iterator.hasNext())
+            Configuration values = subset(section);
+            Iterator keys = values.getKeys();
+            while (keys.hasNext())
             {
-                String key = (String) iterator.next();
+                String key = (String) keys.next();
                 String value = values.getString(key);
                 pw.print(key);
                 pw.print(" = ");
                 pw.print(formatValue(value));
-                pw.print(LINE_SEPARATOR);
+                pw.println();
             }
 
-            pw.print(LINE_SEPARATOR);
+            pw.println();
         }
+
+        pw.flush();
     }
 
     /**

Modified: jakarta/commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/xdocs/changes.xml?view=diff&rev=531399&r1=531398&r2=531399
==============================================================================
--- jakarta/commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/configuration/trunk/xdocs/changes.xml Mon Apr 23 02:39:29 2007
@@ -23,6 +23,13 @@
 
   <body>
     <release version="1.5-SNAPSHOT" date="in SVN" description="">
+      <action dev="ebourg" type="update">
+        INIConfiguration uses the platform's specific line separator instead
+        of the Windows line separator.
+      </action>
+      <action dev="ebourg" type="fix" issue="CONFIGURATION-267">
+        INIConfiguration flushes the output at the end of a save operation.
+      </action>
       <action dev="oheger" type="update" issue="CONFIGURATION-265">
         For hierarchical file-based configurations the auto-save mechanism is
         now also triggered if a subnode configuration is changed. In such a case



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