commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r627991 - in /commons/proper/configuration/branches/configuration2_experimental/src: main/java/org/apache/commons/configuration2/ main/java/org/apache/commons/configuration2/plist/ main/java/org/apache/commons/configuration2/tree/ main/java...
Date Fri, 15 Feb 2008 10:07:55 GMT
Author: ebourg
Date: Fri Feb 15 02:07:53 2008
New Revision: 627991

URL: http://svn.apache.org/viewvc?rev=627991&view=rev
Log:
Turned the StringBuffers into StringBuilders

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfigurationLayout.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLPropertiesConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfigurationLayout.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertyConverter.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java
Fri Feb 15 02:07:53 2008
@@ -59,7 +59,7 @@
     /** Constant for an index end marker.*/
     private static final char INDEX_END = ')';
 
-    /** Constant for the initial StringBuffer size.*/
+    /** Constant for the initial StringBuilder size.*/
     private static final int INITIAL_SIZE = 32;
 
     /**
@@ -68,14 +68,14 @@
     private static final long serialVersionUID = -4299732083605277656L;
 
     /** Holds a buffer with the so far created key.*/
-    private StringBuffer keyBuffer;
+    private StringBuilder keyBuffer;
 
     /**
      * Creates a new, empty instance of <code>ConfigurationKey</code>.
      */
     public ConfigurationKey()
     {
-        keyBuffer = new StringBuffer(INITIAL_SIZE);
+        keyBuffer = new StringBuilder(INITIAL_SIZE);
     }
 
     /**
@@ -86,7 +86,7 @@
      */
     public ConfigurationKey(String key)
     {
-        keyBuffer = new StringBuffer(key);
+        keyBuffer = new StringBuilder(key);
         removeTrailingDelimiter();
     }
 
@@ -168,7 +168,7 @@
      */
     public static String constructAttributeKey(String key)
     {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         buf.append(ATTRIBUTE_START).append(key).append(ATTRIBUTE_END);
         return buf.toString();
     }
@@ -443,10 +443,9 @@
          */
         private String nextKeyPart()
         {
-            StringBuffer key = new StringBuffer(INITIAL_SIZE);
+            StringBuilder key = new StringBuilder(INITIAL_SIZE);
             int idx = startIndex;
-            int endIdx = keyBuffer.toString().indexOf(ATTRIBUTE_START,
-                    startIndex);
+            int endIdx = keyBuffer.toString().indexOf(ATTRIBUTE_START, startIndex);
             if (endIdx < 0 || endIdx == startIndex)
             {
                 endIdx = keyBuffer.length();

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
Fri Feb 15 02:07:53 2008
@@ -337,7 +337,7 @@
         }
         else
         {
-            StringBuffer fName = new StringBuffer();
+            StringBuilder fName = new StringBuilder();
             fName.append(basePath);
 
             // My best friend. Paranoia.
@@ -393,7 +393,7 @@
     {
         if (log.isDebugEnabled())
         {
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             buf.append("ConfigurationUtils.locate(): base is ").append(base);
             buf.append(", name is ").append(name);
             log.debug(buf.toString());

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfiguration.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfiguration.java
Fri Feb 15 02:07:53 2008
@@ -281,8 +281,7 @@
     {
         if (engine == null)
         {
-            throw new IllegalArgumentException(
-                    "Default expression engine must not be null!");
+            throw new IllegalArgumentException("Default expression engine must not be null!");
         }
         defaultExpressionEngine = engine;
     }
@@ -297,8 +296,7 @@
      */
     public ExpressionEngine getExpressionEngine()
     {
-        return (expressionEngine != null) ? expressionEngine
-                : getDefaultExpressionEngine();
+        return (expressionEngine != null) ? expressionEngine : getDefaultExpressionEngine();
     }
 
     /**
@@ -406,14 +404,12 @@
         else
         {
             // otherwise perform an add operation
-            parent = processNodeAddData(getExpressionEngine().prepareAdd(
-                    getRootNode(), key));
+            parent = processNodeAddData(getExpressionEngine().prepareAdd(getRootNode(), key));
         }
 
         if (parent.isAttribute())
         {
-            throw new IllegalArgumentException(
-                    "Cannot add nodes to an attribute node!");
+            throw new IllegalArgumentException("Cannot add nodes to an attribute node!");
         }
 
         // a visitor to ensure that the nodes' references are cleared; this is
@@ -567,17 +563,14 @@
      * @see SubnodeConfiguration
      * @since 1.5
      */
-    public SubnodeConfiguration configurationAt(String key,
-            boolean supportUpdates)
+    public SubnodeConfiguration configurationAt(String key, boolean supportUpdates)
     {
         List<ConfigurationNode> nodes = fetchNodeList(key);
         if (nodes.size() != 1)
         {
-            throw new IllegalArgumentException(
-                    "Passed in key must select exactly one node: " + key);
+            throw new IllegalArgumentException("Passed in key must select exactly one node:
" + key);
         }
-        return supportUpdates ? createSubnodeConfiguration(nodes.get(0), key)
-                : createSubnodeConfiguration(nodes.get(0));
+        return supportUpdates ? createSubnodeConfiguration(nodes.get(0), key) : createSubnodeConfiguration(nodes.get(0));
     }
 
     /**
@@ -659,8 +652,7 @@
      * @return the configuration for the given node
      * @since 1.5
      */
-    protected SubnodeConfiguration createSubnodeConfiguration(
-            ConfigurationNode node, String subnodeKey)
+    protected SubnodeConfiguration createSubnodeConfiguration(ConfigurationNode node, String
subnodeKey)
     {
         SubnodeConfiguration result = createSubnodeConfiguration(node);
         result.setSubnodeKey(subnodeKey);
@@ -867,8 +859,7 @@
     {
         try
         {
-            HierarchicalConfiguration copy = (HierarchicalConfiguration) super
-                    .clone();
+            HierarchicalConfiguration copy = (HierarchicalConfiguration) super.clone();
 
             // clone the nodes, too
             CloneVisitor v = new CloneVisitor();
@@ -1267,27 +1258,20 @@
                 length = key.length();
                 if (getName() != null)
                 {
-                    key
-                            .append(StringUtils
-                                    .replace(
-                                            isAttribute() ? ConfigurationKey
-                                                    .constructAttributeKey(getName())
-                                                    : getName(),
-                                            String
-                                                    .valueOf(ConfigurationKey.PROPERTY_DELIMITER),
-                                            ConfigurationKey.ESCAPED_DELIMITER));
+                    key.append(StringUtils.replace(
+                        isAttribute() ? ConfigurationKey.constructAttributeKey(getName())
: getName(),
+                        String.valueOf(ConfigurationKey.PROPERTY_DELIMITER),
+                        ConfigurationKey.ESCAPED_DELIMITER));
                 }
             }
 
             visitor.visitBeforeChildren(this, key);
 
-            for (Iterator<ConfigurationNode> it = getChildren().iterator(); it.hasNext()
-                    && !visitor.terminate();)
+            for (Iterator<ConfigurationNode> it = getChildren().iterator(); it.hasNext()
&& !visitor.terminate();)
             {
                 ((Node) it.next()).visit(visitor, key);
             }
-            for (Iterator<ConfigurationNode> it = getAttributes().iterator(); it.hasNext()
-                    && !visitor.terminate();)
+            for (Iterator<ConfigurationNode> it = getAttributes().iterator(); it.hasNext()
&& !visitor.terminate();)
             {
                 ((Node) it.next()).visit(visitor, key);
             }
@@ -1455,8 +1439,7 @@
          */
         public void visitBeforeChildren(ConfigurationNode node)
         {
-            String parentKey = parentKeys.isEmpty() ? null
-                    : (String) parentKeys.peek();
+            String parentKey = parentKeys.isEmpty() ? null : (String) parentKeys.peek();
             String key = getExpressionEngine().nodeKey(node, parentKey);
             parentKeys.push(key);
             if (node.getValue() != null)

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=627991&r1=627990&r2=627991&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
Fri Feb 15 02:07:53 2008
@@ -350,7 +350,7 @@
 
         int i = quoted ? 1 : 0;
 
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         while (i < value.length() && !stop)
         {
             char c = value.charAt(i);

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
Fri Feb 15 02:07:53 2008
@@ -136,7 +136,7 @@
                 Object object = context.lookup(name);
 
                 // build the key
-                StringBuffer key = new StringBuffer();
+                StringBuilder key = new StringBuilder();
                 key.append(prefix);
                 if (key.length() > 0)
                 {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfiguration.java
Fri Feb 15 02:07:53 2008
@@ -593,7 +593,7 @@
         public String readProperty() throws IOException
         {
             commentLines.clear();
-            StringBuffer buffer = new StringBuffer();
+            StringBuilder buffer = new StringBuilder();
 
             while (true)
             {
@@ -722,8 +722,8 @@
             // possible with a regexp when the Java 1.3 requirement is dropped
 
             String[] result = new String[2];
-            StringBuffer key = new StringBuffer();
-            StringBuffer value = new StringBuffer();
+            StringBuilder key = new StringBuilder();
+            StringBuilder value = new StringBuilder();
 
             // state of the automaton:
             // 0: key parsing
@@ -924,7 +924,7 @@
          */
         private String escapeKey(String key)
         {
-            StringBuffer newkey = new StringBuffer();
+            StringBuilder newkey = new StringBuilder();
 
             for (int i = 0; i < key.length(); i++)
             {
@@ -1035,8 +1035,8 @@
             return null;
         }
         int sz = str.length();
-        StringBuffer out = new StringBuffer(sz);
-        StringBuffer unicode = new StringBuffer(UNICODE_LEN);
+        StringBuilder out = new StringBuilder(sz);
+        StringBuilder unicode = new StringBuilder(UNICODE_LEN);
         boolean hadSlash = false;
         boolean inUnicode = false;
         for (int i = 0; i < sz; i++)

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfigurationLayout.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfigurationLayout.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfigurationLayout.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertiesConfigurationLayout.java
Fri Feb 15 02:07:53 2008
@@ -582,7 +582,7 @@
      */
     static String trimComment(String s, boolean comment)
     {
-        StringBuffer buf = new StringBuffer(s.length());
+        StringBuilder buf = new StringBuilder(s.length());
         int lastPos = 0;
         int pos;
 
@@ -731,7 +731,7 @@
     static class PropertyLayoutData implements Cloneable
     {
         /** Stores the comment for the property. */
-        private StringBuffer comment;
+        private StringBuilder comment;
 
         /** Stores the number of blanc lines before this property. */
         private int blancLines;
@@ -799,7 +799,7 @@
             {
                 if (comment == null)
                 {
-                    comment = new StringBuffer(s);
+                    comment = new StringBuilder(s);
                 }
                 else
                 {
@@ -821,7 +821,7 @@
             }
             else
             {
-                comment = new StringBuffer(s);
+                comment = new StringBuilder(s);
             }
         }
 
@@ -849,7 +849,7 @@
                 if (comment != null)
                 {
                     // must copy string buffer, too
-                    copy.comment = new StringBuffer(getComment());
+                    copy.comment = new StringBuilder(getComment());
                 }
                 return copy;
             }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
Fri Feb 15 02:07:53 2008
@@ -439,7 +439,7 @@
     private void constructHierarchy(Node node, Element element, boolean elemRefs)
     {
         processAttributes(node, element, elemRefs);
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         NodeList list = element.getChildNodes();
         for (int i = 0; i < list.getLength(); i++)
         {
@@ -447,8 +447,7 @@
             if (w3cNode instanceof Element)
             {
                 Element child = (Element) w3cNode;
-                Node childNode = new XMLNode(child.getTagName(),
-                        elemRefs ? child : null);
+                Node childNode = new XMLNode(child.getTagName(), elemRefs ? child : null);
                 constructHierarchy(childNode, child, elemRefs);
                 node.addChild(childNode);
                 handleDelimiters(node, childNode);
@@ -1211,7 +1210,7 @@
             if (node != null && elem != null)
             {
                 List<ConfigurationNode> attributes = node.getAttributes(name);
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 char delimiter = (listDelimiter != 0) ? listDelimiter : ATTR_VALUE_DELIMITER;
                 for (ConfigurationNode attribute : attributes)
                 {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLPropertiesConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLPropertiesConfiguration.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLPropertiesConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLPropertiesConfiguration.java
Fri Feb 15 02:07:53 2008
@@ -245,7 +245,7 @@
         private String key;
 
         /** The value of the current entry being parsed. */
-        private StringBuffer value = new StringBuffer();
+        private StringBuilder value = new StringBuilder();
 
         /** Indicates that a comment is being parsed. */
         private boolean inCommentElement;
@@ -284,7 +284,7 @@
             }
 
             // Clear the element value buffer
-            value = new StringBuffer();
+            value = new StringBuilder();
         }
 
         public void characters(char[] chars, int start, int length)

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
Fri Feb 15 02:07:53 2008
@@ -452,7 +452,7 @@
      */
     static String formatDate(Calendar cal)
     {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
 
         for (int i = 0; i < DATE_PARSERS.length; i++)
         {
@@ -503,7 +503,7 @@
          * @param buf the target buffer
          * @param cal the calendar with the current date
          */
-        public abstract void formatComponent(StringBuffer buf, Calendar cal);
+        public abstract void formatComponent(StringBuilder buf, Calendar cal);
 
         /**
          * Checks whether the given string has at least <code>length</code>
@@ -534,10 +534,9 @@
          * @param num the number to add
          * @param length the required length
          */
-        protected void padNum(StringBuffer buf, int num, int length)
+        protected void padNum(StringBuilder buf, int num, int length)
         {
-            buf.append(StringUtils.leftPad(String.valueOf(num), length,
-                    PAD_CHAR));
+            buf.append(StringUtils.leftPad(String.valueOf(num), length, PAD_CHAR));
         }
     }
 
@@ -583,7 +582,7 @@
             offset = ofs;
         }
 
-        public void formatComponent(StringBuffer buf, Calendar cal)
+        public void formatComponent(StringBuilder buf, Calendar cal)
         {
             padNum(buf, cal.get(calendarField) + offset, length);
         }
@@ -594,15 +593,12 @@
             checkLength(s, index, length);
             try
             {
-                cal.set(calendarField, Integer.parseInt(s.substring(index,
-                        index + length))
-                        - offset);
+                cal.set(calendarField, Integer.parseInt(s.substring(index, index + length))
- offset);
                 return length;
             }
             catch (NumberFormatException nfex)
             {
-                throw new ParseException("Invalid number: " + s + ", index "
-                        + index);
+                throw new ParseException("Invalid number: " + s + ", index " + index);
             }
         }
     }
@@ -627,7 +623,7 @@
             separator = sep;
         }
 
-        public void formatComponent(StringBuffer buf, Calendar cal)
+        public void formatComponent(StringBuilder buf, Calendar cal)
         {
             buf.append(separator);
         }
@@ -638,8 +634,7 @@
             checkLength(s, index, separator.length());
             if (!s.startsWith(separator, index))
             {
-                throw new ParseException("Invalid input: " + s + ", index "
-                        + index + ", expected " + separator);
+                throw new ParseException("Invalid input: " + s + ", index " + index + ",
expected " + separator);
             }
             return separator.length();
         }
@@ -651,7 +646,7 @@
      */
     private static class DateTimeZoneParser extends DateComponentParser
     {
-        public void formatComponent(StringBuffer buf, Calendar cal)
+        public void formatComponent(StringBuilder buf, Calendar cal)
         {
             TimeZone tz = cal.getTimeZone();
             int ofs = tz.getRawOffset() / MILLIS_PER_MINUTE;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java
Fri Feb 15 02:07:53 2008
@@ -406,7 +406,7 @@
     private class XMLPropertyListHandler extends DefaultHandler
     {
         /** The buffer containing the text node being read */
-        private StringBuffer buffer = new StringBuffer();
+        private StringBuilder buffer = new StringBuilder();
 
         /** The stack of configuration nodes */
         private List<Node> stack = new ArrayList<Node>();

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java
Fri Feb 15 02:07:53 2008
@@ -51,14 +51,14 @@
  */
 public class DefaultConfigurationKey
 {
-    /** Constant for the initial StringBuffer size. */
+    /** Constant for the initial StringBuilder size. */
     private static final int INITIAL_SIZE = 32;
 
     /** Stores a reference to the associated expression engine. */
     private DefaultExpressionEngine expressionEngine;
 
     /** Holds a buffer with the so far created key. */
-    private StringBuffer keyBuffer;
+    private StringBuilder keyBuffer;
 
     /**
      * Creates a new instance of <code>DefaultConfigurationKey</code> and sets
@@ -68,7 +68,7 @@
      */
     public DefaultConfigurationKey(DefaultExpressionEngine engine)
     {
-        keyBuffer = new StringBuffer(INITIAL_SIZE);
+        keyBuffer = new StringBuilder(INITIAL_SIZE);
         setExpressionEngine(engine);
     }
 
@@ -82,7 +82,7 @@
     public DefaultConfigurationKey(DefaultExpressionEngine engine, String key)
     {
         setExpressionEngine(engine);
-        keyBuffer = new StringBuffer(trim(key));
+        keyBuffer = new StringBuilder(trim(key));
     }
 
     /**
@@ -282,7 +282,7 @@
         }
         else
         {
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             buf.append(getExpressionEngine().getAttributeStart()).append(key);
             if (getExpressionEngine().getAttributeEnd() != null)
             {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
Fri Feb 15 02:07:53 2008
@@ -172,8 +172,7 @@
 
         else
         {
-            StringBuffer buf = new StringBuffer(parentKey.length()
-                    + node.getName().length() + PATH_DELIMITER.length());
+            StringBuilder buf = new StringBuilder(parentKey.length() + node.getName().length()
+ PATH_DELIMITER.length());
             if (parentKey.length() > 0)
             {
                 buf.append(parentKey);

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfigurationLayout.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfigurationLayout.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfigurationLayout.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfigurationLayout.java
Fri Feb 15 02:07:53 2008
@@ -21,11 +21,6 @@
 import java.io.StringWriter;
 import java.util.Iterator;
 
-import org.apache.commons.configuration2.AbstractConfiguration;
-import org.apache.commons.configuration2.AbstractFileConfiguration;
-import org.apache.commons.configuration2.ConfigurationException;
-import org.apache.commons.configuration2.PropertiesConfiguration;
-import org.apache.commons.configuration2.PropertiesConfigurationLayout;
 import org.apache.commons.configuration2.event.ConfigurationEvent;
 
 import junit.framework.TestCase;
@@ -654,7 +649,7 @@
     static class PropertiesBuilder
     {
         /** A buffer for storing the data. */
-        private StringBuffer buf = new StringBuffer();
+        private StringBuilder buf = new StringBuilder();
 
         /** A counter for varying the comment character. */
         private int commentCounter;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertyConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertyConverter.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertyConverter.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertyConverter.java
Fri Feb 15 02:07:53 2008
@@ -305,7 +305,7 @@
     public void testToNumberFromString()
     {
         assertEquals("Incorrect Integer value", new Integer(42), PropertyConverter.toNumber("42",
Integer.class));
-        assertEquals("Incorrect Short value", new Short((short) 10), PropertyConverter.toNumber(new
StringBuffer("10"), Short.class));
+        assertEquals("Incorrect Short value", new Short((short) 10), PropertyConverter.toNumber(new
StringBuilder("10"), Short.class));
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java?rev=627991&r1=627990&r2=627991&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java
Fri Feb 15 02:07:53 2008
@@ -1,5 +1,3 @@
-package org.apache.commons.configuration2.test;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -17,6 +15,8 @@
  * limitations under the License.
  */
 
+package org.apache.commons.configuration2.test;
+
 import java.io.FileReader;
 
 import java.sql.Connection;
@@ -40,17 +40,16 @@
     private Connection connection = null;
     private static Log log = LogFactory.getLog(HsqlDB.class);
 
-    public HsqlDB(String uri, String databaseDriver, String loadFile)
-            throws Exception
+    public HsqlDB(String uri, String databaseDriver, String loadFile)throws Exception
     {
         Class.forName(databaseDriver);
 
         this.connection = DriverManager.getConnection(uri, "sa", "");
 
-            if (StringUtils.isNotEmpty(loadFile))
-            {
-                loadSqlFile(loadFile);
-            }
+        if (StringUtils.isNotEmpty(loadFile))
+        {
+            loadSqlFile(loadFile);
+        }
         this.connection.commit();
     }
 
@@ -70,8 +69,7 @@
         }
     }
 
-    private void loadSqlFile(String fileName)
-            throws Exception
+    private void loadSqlFile(String fileName) throws Exception
     {
         Statement statement = null;
         try
@@ -103,13 +101,12 @@
         }
     }
 
-    private String getFileContents(String fileName)
-            throws Exception
+    private String getFileContents(String fileName) throws Exception
     {
         FileReader fr = new FileReader(fileName);
 
         char fileBuf[]  = new char[1024];
-        StringBuffer sb = new StringBuffer(1000);
+        StringBuilder sb = new StringBuilder(1000);
         int res = -1;
 
         while ((res = fr.read(fileBuf, 0, 1024)) > -1)



Mime
View raw message