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/04/05 13:32:16 UTC

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

Author: ebourg
Date: Tue Apr  5 04:32:14 2005
New Revision: 160160

URL: http://svn.apache.org/viewcvs?view=rev&rev=160160
Log:
Fixed XMLConfiguration to use the delimiter set by setDelimiter() instead of the private ATTR_DELIMITER variable (thanks to Zsolt Koppany for spotting this issue)

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

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java?view=diff&r1=160159&r2=160160
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/XMLConfiguration.java Tue Apr  5 04:32:14 2005
@@ -70,9 +70,6 @@
     /** Constant for the default root element name. */
     private static final String DEFAULT_ROOT_NAME = "configuration";
 
-    /** Delimiter character for attributes. */
-    private static char ATTR_DELIMITER = ',';
-
     private FileConfigurationDelegate delegate = new FileConfigurationDelegate();
 
     /** The document from this configuration's data source. */
@@ -288,7 +285,7 @@
             if (w3cNode instanceof Attr)
             {
                 Attr attr = (Attr) w3cNode;
-                for (Iterator it = PropertyConverter.split(attr.getValue(), ATTR_DELIMITER).iterator(); it.hasNext();)
+                for (Iterator it = PropertyConverter.split(attr.getValue(), getDelimiter()).iterator(); it.hasNext();)
                 {
                     Node child = new XMLNode(ConfigurationKey.constructAttributeKey(attr.getName()), element);
                     child.setValue(it.next());
@@ -365,7 +362,19 @@
 
     public void load(InputStream in) throws ConfigurationException
     {
-        delegate.load(in);
+        try
+        {
+            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            Document newDocument = builder.parse(new InputSource(in));
+            Document oldDocument = document;
+            document = null;
+            initProperties(newDocument, oldDocument == null);
+            document = (oldDocument == null) ? newDocument : oldDocument;
+        }
+        catch (Exception e)
+        {
+            throw new ConfigurationException(e.getMessage(), e);
+        }
     }
 
     public void load(InputStream in, String encoding) throws ConfigurationException
@@ -782,7 +791,7 @@
                     {
                         if (buf.length() > 0)
                         {
-                            buf.append(ATTR_DELIMITER);
+                            buf.append(getDelimiter());
                         }
                         buf.append(attr.getValue());
                     }

Modified: jakarta/commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/xdocs/changes.xml?view=diff&r1=160159&r2=160160
==============================================================================
--- jakarta/commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/configuration/trunk/xdocs/changes.xml Tue Apr  5 04:32:14 2005
@@ -22,7 +22,10 @@
 
   <body>
 
-    <release version="1.2-dev" date="in CVS">
+    <release version="1.2-dev" date="in SVN">
+      <action dev="ebourg" type="update" due-to="Zsolt Koppany">
+        XMLConfiguration now uses the delimiter set by setDelimiter(char).
+      </action>
     </release>
 
     <release version="1.1" date="2005-04-02">



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