hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r231296 - in /jakarta/hivemind/trunk/framework/src: java/org/apache/hivemind/util/ClassAdaptor.java java/org/apache/hivemind/util/PropertyUtils.java test/org/apache/hivemind/util/TestPropertyUtils.java
Date Wed, 10 Aug 2005 19:33:51 GMT
Author: ahuegen
Date: Wed Aug 10 12:33:42 2005
New Revision: 231296

URL: http://svn.apache.org/viewcvs?rev=231296&view=rev
Log:
Property names are trimmed (HIVEMIND-138)

Modified:
    jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/ClassAdaptor.java
    jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/PropertyUtils.java
    jakarta/hivemind/trunk/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java

Modified: jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/ClassAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/ClassAdaptor.java?rev=231296&r1=231295&r2=231296&view=diff
==============================================================================
--- jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/ClassAdaptor.java (original)
+++ jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/ClassAdaptor.java Wed
Aug 10 12:33:42 2005
@@ -205,8 +205,6 @@
      * </ul>
      * The later two are for boolean properties (true and false, respectively).
      * 
-     * TODO: Should we strip whitespace from around properety names?  From around
-     * values?
      * @since 1.1
      */
     private void configurePropertyFromToken(Object target, String token)
@@ -215,7 +213,7 @@
 
         if (equalsx > 0)
         {
-            String propertyName = token.substring(0, equalsx);
+            String propertyName = token.substring(0, equalsx).trim();
             String value = token.substring(equalsx + 1);
 
             smartWrite(target, propertyName, value);

Modified: jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/PropertyUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/PropertyUtils.java?rev=231296&r1=231295&r2=231296&view=diff
==============================================================================
--- jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/PropertyUtils.java
(original)
+++ jakarta/hivemind/trunk/framework/src/java/org/apache/hivemind/util/PropertyUtils.java
Wed Aug 10 12:33:42 2005
@@ -70,7 +70,8 @@
     /**
      * Initializes the properties of an object from a string. The string is a comma-seperated
      * sequence of property names and values. Property names are seperated from values be
an equals
-     * sign. For boolean properties, the equals sign and value may be omitted (a value of
true is
+     * sign. Spaces before and after the property names are trimmed.
+     * For boolean properties, the equals sign and value may be omitted (a value of true
is
      * assumed), or the property name may be prefixed with an exclamation point to indicated
false
      * value. Example: <code>validate,maxLength=10,displayName=User Id</code>.
      * 

Modified: jakarta/hivemind/trunk/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/hivemind/trunk/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java?rev=231296&r1=231295&r2=231296&view=diff
==============================================================================
--- jakarta/hivemind/trunk/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java
(original)
+++ jakarta/hivemind/trunk/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java
Wed Aug 10 12:33:42 2005
@@ -494,11 +494,13 @@
     {
         MultiPropertyBean b = new MultiPropertyBean();
 
-        PropertyUtils.configureProperties(b, "integer=42,long=-937,string=HiveMind,flag");
+        // Note that one property name is preceded by a space to test trimming
+        PropertyUtils.configureProperties(b, "integer=42,long=-937, string=HiveMind,flag");
 
         assertEquals(new Integer(42), b.getInteger());
         assertEquals(-937, b.getLong());
         assertEquals("HiveMind", b.getString());
         assertEquals(true, b.isFlag());
     }
+    
 }



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


Mime
View raw message