I have a little bit of code in a class running in Java 1.7.0_17 and Jboss 4.2.3GA under windows. The code does this:
Date newNextDate = inBetween(currentDate, nextDate, start);
print("newNextDate=" + newNextDate);
The inbetween does a fairly simply comparison:
private Date inBetween(Date start, Date end, Date test) {
...
Date contains = t.contains(test) ? test : end;
print("returning contains=" + contains);
return contains;
}
The exact implementation contains is not relevant IMHO, because in the end results in a java.util.Date being assigned to the contains variable. The output on stdout is:
16:44:56,153 INFO returning contains=Tue Apr 30 23:59:59 CEST 2013
16:44:56,153 INFO newNextDate=null
And this where where the mystery begins: 1. just prior to the return statement the contains variable has a value 2. after returning the collecting variable is null
How in the world is this possible?
The strangest thing is, it only occurs here, nowhere else in the 1.000.000 lines of code.
Maybe you have overloaded your inBetween and that gets called:
private Date inBetween(long start, Date end, Date test) {
Date result = null;
inBetween(new Date(start), end, test);
return result;
}
Or something similarly typical. A catch ... return null
.
The only other technical way would be to have an AOP interceptor doing a wrong caching (memoization?) or so. Unlikely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With