From d34dce48e5cd02ef1f078a939741d79fab3c39d0 Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Sun, 6 Feb 2011 06:58:08 +0000 Subject: [PATCH] Adding note on potential NPE if autoboxing occurs per LANG-676 git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1067606 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/lang3/BooleanUtils.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/apache/commons/lang3/BooleanUtils.java b/src/main/java/org/apache/commons/lang3/BooleanUtils.java index 567fdb356..c7eae2d05 100644 --- a/src/main/java/org/apache/commons/lang3/BooleanUtils.java +++ b/src/main/java/org/apache/commons/lang3/BooleanUtils.java @@ -52,6 +52,8 @@ public class BooleanUtils { * *

If null is passed in, null will be returned.

* + *

NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.

+ * *
      *   BooleanUtils.negate(Boolean.TRUE)  = Boolean.FALSE;
      *   BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE;
@@ -234,6 +236,8 @@ public class BooleanUtils {
      * 
      * 

null will be converted to null.

* + *

NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.

+ * *
      *   BooleanUtils.toBoolean(new Integer(0))    = Boolean.FALSE
      *   BooleanUtils.toBoolean(new Integer(1))    = Boolean.TRUE
@@ -315,6 +319,8 @@ public class BooleanUtils {
     /**
      * 

Converts an int to a Boolean specifying the conversion values.

* + *

NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.

+ * *
      *   BooleanUtils.toBooleanObject(0, 0, 2, 3) = Boolean.TRUE
      *   BooleanUtils.toBooleanObject(2, 1, 2, 3) = Boolean.FALSE
@@ -343,6 +349,8 @@ public class BooleanUtils {
     /**
      * 

Converts an Integer to a Boolean specifying the conversion values.

* + *

NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.

+ * *
      *   BooleanUtils.toBooleanObject(new Integer(0), new Integer(0), new Integer(2), new Integer(3)) = Boolean.TRUE
      *   BooleanUtils.toBooleanObject(new Integer(2), new Integer(1), new Integer(2), new Integer(3)) = Boolean.FALSE
@@ -528,6 +536,8 @@ public class BooleanUtils {
      * (case insensitive) will return false.
      * Otherwise, null is returned.

* + *

NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.

+ * *
      *   BooleanUtils.toBooleanObject(null)    = null
      *   BooleanUtils.toBooleanObject("true")  = Boolean.TRUE
@@ -642,6 +652,8 @@ public class BooleanUtils {
     /**
      * 

Converts a String to a Boolean throwing an exception if no match.

* + *

NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.

+ * *
      *   BooleanUtils.toBooleanObject("true", "true", "false", "null")  = Boolean.TRUE
      *   BooleanUtils.toBooleanObject("false", "true", "false", "null") = Boolean.FALSE