Hi,
FindBugs is displaying incorrect message for the
bug DMI_BAD_MONTH. (DMI: Passes a constant value for a
month outside of the expected range of 0..11). The
message is given for followng piece of code where it
calls the setDate() method on a java.util.Date object.
today.setDate(16);
Actually this error is to be given for setMonth().
FindBugs 0.9.6 is used.
The full source code is given below.
import java.util.Date;
import java.util.Calendar;
public class TestDate {
public static void main(String args[]) {
Date today = Calendar.getInstance().getTime();
System.out.println(today);
today.setDate(16);
System.out.println(today);
}
}
I am attaching the saved bug report.
Regards,
Anto Paul
Saved bug
Logged In: YES
user_id=66596
thanks for the report, was checking for setDate, when should
have been checking for setMonth.
fixed in cvs