I have some 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);
A fairly simple comparison is made between them:
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 does not apply to IMHO, because in the end the results are assigned to the java.util.Date variable. Output to stdout:
16:44:56,153 INFO returning contains=Tue Apr 30 23:59:59 CEST 2013 16:44:56,153 INFO newNextDate=null
And this is where the mystery begins: 1. immediately before the return statement, the contains variable has the value 2. after the return, the collecting variable is null
How is this possible in the world?
- Yes, we checked whether this particular method was called inbetween, otherwise it would not print the result.
- No, there is no instance variable with the same name. But even if nothing happens between them.
- No, we cannot debug the process, because it occurs only on our production servers and is not reproduced during development.
The strangest thing is that this happens only here, nowhere in 1,000,000 lines of code.
source share