diff --git a/WHATSNEW b/WHATSNEW index c9b0f376e..245bc460f 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -233,6 +233,9 @@ Fixed bugs: or in the top package. Bugzilla Report 21915. +* Project.toBoolean(String) now handles null as argument and does not throw a + NullPointerException any more. + Other changes: -------------- * All tasks can be used outside of s. Note that some tasks @@ -586,7 +589,7 @@ Other changes: Bugzilla Report 22533. * additional shortcuts for ant options (-d --> -debug, -e --> -emacs, - -h --> -help, -p --> -projecthelp, -s --> -find) + -h --> -help, -p --> -projecthelp, -s --> -find). Changes from Ant 1.5.3 to Ant 1.5.4 =================================== diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index d5f130854..e308286a4 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -1569,16 +1569,15 @@ public class Project { * or "yes" is found, ignoring case. * * @param s The string to convert to a boolean value. - * Must not be null. * * @return true if the given string is "on", * "true" or "yes", or * false otherwise. */ public static boolean toBoolean(String s) { - return (s.equalsIgnoreCase("on") - || s.equalsIgnoreCase("true") - || s.equalsIgnoreCase("yes")); + return ("on".equalsIgnoreCase(s) + || "true".equalsIgnoreCase(s) + || "yes".equalsIgnoreCase(s)); } /** @@ -2097,4 +2096,4 @@ public class Project { // is private/protected. } } -} +} \ No newline at end of file