peterreilly 2003/11/27 02:16:14 Modified: src/main/org/apache/tools/ant/util ScriptRunner.java Log: Allow references and properties to be null without causing NPE in BSF Revision Changes Path 1.3 +9 -1 ant/src/main/org/apache/tools/ant/util/ScriptRunner.java Index: ScriptRunner.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/ScriptRunner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ScriptRunner.java 22 Oct 2003 09:23:34 -0000 1.2 +++ ScriptRunner.java 27 Nov 2003 10:16:13 -0000 1.3 @@ -139,7 +139,15 @@ 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
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]