Browse Source

Allow references and properties to be null without causing NPE in BSF

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275699 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
efef302a3d
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/main/org/apache/tools/ant/util/ScriptRunner.java

+ 9
- 1
src/main/org/apache/tools/ant/util/ScriptRunner.java View File

@@ -139,7 +139,15 @@ public class ScriptRunner {
for (Iterator i = beans.keySet().iterator(); i.hasNext();) {
String key = (String) i.next();
Object value = beans.get(key);
manager.declareBean(key, value, value.getClass());
if (value != null) {
manager.declareBean(key, value, value.getClass());
} else {
// BSF uses a hashtable to store values
// so cannot declareBean with a null value
// So need to remove any bean of this name as
// that bean should not be visible
manager.undeclareBean(key);
}
}

// execute the script


Loading…
Cancel
Save