commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1068537 - in /commons/sandbox/digester3/trunk/src: main/java/org/apache/commons/digester3/RulesBinderImpl.java test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java
Date Tue, 08 Feb 2011 19:22:31 GMT
Author: simonetripodi
Date: Tue Feb  8 19:22:30 2011
New Revision: 1068537

URL: http://svn.apache.org/viewvc?rev=1068537&view=rev
Log:
when explicitly specifying an alias on SetPropertiesRule, null values are not allowed

Modified:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java?rev=1068537&r1=1068536&r2=1068537&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
Tue Feb  8 19:22:30 2011
@@ -252,12 +252,17 @@ final class RulesBinderImpl implements R
                         return this;
                     }
 
-                    public SetPropertiesBuilder addAlias(String attributeName, /* @Nullable
*/String propertyName) {
+                    public SetPropertiesBuilder addAlias(String attributeName, String propertyName)
{
                         if (attributeName == null) {
                             addError("{forPattern(\"%s\").setProperties().addAlias(String,String)}
empty 'attributeName' not allowed",
                                     keyPattern);
                         } else {
-                            this.aliases.put(attributeName, propertyName);
+                            if (propertyName == null) {
+                                addError("{forPattern(\"%s\").setProperties().addAlias(String,String)}
empty 'propertyName' not allowed",
+                                        keyPattern);
+                            } else {
+                                this.aliases.put(attributeName, propertyName);
+                            }
                         }
                         return this;
                     }

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java?rev=1068537&r1=1068536&r2=1068537&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java
(original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java
Tue Feb  8 19:22:30 2011
@@ -168,7 +168,9 @@ public class SetPropertiesRuleTestCase e
                 forPattern("root")
                     .createObject().ofType("org.apache.commons.digester3.SimpleTestBean")
                     .then()
-                    .setProperties().ignoreMissingProperty(false).addAlias("ignore", null);
+                    .setProperties()
+                        .ignoreMissingProperty(false)
+                        .ignoreAttribute("ignore");
             }
 
         }).parse(xmlTestReader(TEST_XML_3));



Mime
View raw message