FindBugs: Possible Null Pointer Dereferencing
Hi I have the following method:
protected boolean shouldCheckLimit() {
if (startDate == null || endDate == null) {
return true;
}
final Long currentTime = System.currentTimeMillis();
if (startDate <= currentTime && currentTime < endDate) {
return true;
}
return false;
}
The problem is that findBugs encountered the following problem:
Possible null pointer dereference of TimeIntervalLimit.startDate in com.bet.blues.limit.TimeIntervalLimit.shouldCheckLimit() [Scary(8), Normal
I must mention that startDate and endDate are long variables. I tried adding checks for null inside if condition, also I tried using longValue () method but no result. Do you know how I can fix this problem? Could there be a bug on the fndBugs side?
+3
source to share