-
I known that the code can be simplified and this is what we did after FindBugs complained about it, but I cannot follow your argument: there are 4 cases, because I have 2 variables with both of them can be either null or not null. The code reflects these 4 cases using a shortcut with return and no else-if. The last statement is for the 4th case where both parameters are not null.
If I get you...
2009-12-10 13:22:45 UTC in FindBugs
-
Bug 2845646 has been closed, so I have to open a new one:
This code:
public int compare(String arg0, String arg1) {
if (null == arg0 && null != arg1) {
return -1;
}
if (null != arg0 && null == arg1) {
return 1;
}
if (null == arg0 && null == arg1) {
return 0;
}
return arg0.compareToIgnoreCase(arg1);
}
Gives this warning:
M D NP: Possible null...
2009-12-08 17:59:07 UTC in FindBugs
-
FindBugs v1.3.9 standalone.
2009-08-27 16:02:45 UTC in FindBugs
-
"value loaded from arg0"; "dereferenced at [2]"; "known null at [1]":
public int compare(String arg0, String arg1) {
if (null == arg0 && null != arg1) {
return -1;
}
if (null != arg0 && null == arg1) {
return 1;
}
[1] if (null...
2009-08-27 16:02:00 UTC in FindBugs