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));


Reply via email to