diff --git a/WHATSNEW b/WHATSNEW index affa69769..f76fae1eb 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -73,6 +73,9 @@ Fixed bugs: within messageLogged while a different thread also accessed one. Bugzilla report 45194 + * Handle null result of system getProperty() in CommandlineJava. + Similar to Bugzilla report 42334. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/types/CommandlineJava.java b/src/main/org/apache/tools/ant/types/CommandlineJava.java index efaa6f437..921eebd81 100644 --- a/src/main/org/apache/tools/ant/types/CommandlineJava.java +++ b/src/main/org/apache/tools/ant/types/CommandlineJava.java @@ -140,7 +140,10 @@ public class CommandlineJava implements Cloneable { Properties p = new Properties(); for (Enumeration e = sys.propertyNames(); e.hasMoreElements();) { String name = (String) e.nextElement(); - p.put(name, sys.getProperty(name)); + String value = sys.getProperty(name); + if (name != null && value != null) { + p.put(name, value); + } } p.putAll(mergePropertySets()); for (Enumeration e = variables.elements(); e.hasMoreElements();) {