@@ -0,0 +1,1100 @@
+package sfBugs;%0D%0A%0D%0Apublic class Bug1908621 %7B%0D%0A%09public static Boolean get_bool() %7B%0D%0A%09%09Boolean test;%0D%0A%09%09%0D%0A%09%09if (1 == (int)Math.round(Math.random())) %7B%0D%0A%09%09%09test = null;%0D%0A%09%09%7D else %7B%0D%0A%09%09%09test = true;%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09return test;%0D%0A%09%7D%0D%0A%09%0D%0A%09/*%0D%0A%09 * Both alternatives do exactly the same. Alternative 1 gets the possible Null-Pointer-Dereference from the method %22get_bool()%22,%0D%0A%09 * Alternative 2 gets the possible Null-Pointer-Dereference directly in the same method.%0D%0A%09 * FindBugs sends the alert only in alternative 2. It should also send the alert in alternative 1.%0D%0A%09 *%0D%0A%09 */%0D%0A%09%0D%0A%09public static void main (String%5B%5D args) %7B%0D%0A%09%09/**%0D%0A%09%09 * Alternative 1: Doesn't create a Null-Pointer-Dereference alert%0D%0A%09%09 */%0D%0A%09%09%0D%0A%09%09Boolean test = get_bool();%0D%0A%09%09%0D%0A%09%09if (test) %7B%0D%0A%09%09%09System.out.println(%22TRUE%22);%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09/**%0D%0A%09%09 * Alternative 2: Creates a Null-Pointer-Dereference alert%0D%0A%09%09 */%0D%0A%09%09%0D%0A%09%09//BEGIN: get_bool()%0D%0A%09%09Boolean test2;%0D%0A%09%09%0D%0A%09%09if (1 == (int)Math.round(Math.random())) %7B%0D%0A%09%09%09test2 = null;%0D%0A%09%09%7D else %7B%0D%0A%09%09%09test2 = true;%0D%0A%09%09%7D%0D%0A%09%09//END: get_bool()%0D%0A%09%09%0D%0A%09%09if (test2) %7B%0D%0A%09%09%09System.out.println(%22TRUE%22);%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%7D%0D%0A

Test case for [ 1908621 ] Null Pointer Dereference