JDK-6765739 : The java 1.4.2_15 Calendar add(DAY_OF_YEAR, 1) does not always increment the date for Brazil TZ.
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.2_15
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-10-30
  • Updated: 2010-12-07
  • Resolved: 2009-03-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
1.4.2_20-rev b05Fixed 6-poolResolved 7Resolved
Related Reports
Relates :  
Description
The java 1.4.2_15 Calendar add(DAY_OF_YEAR, 1) does not always increment the date for Brazil time zone. The problem dates that do not increment are: 20081004 and 20081011.

Code snippet:
                Calendar tmpDate = (Calendar) earlestTime.clone();
                .....

                tmpDate.add(Calendar.DAY_OF_YEAR, 1);  // problem

Comments
EVALUATION This problem is similar to 4958050. The cause is that the old GregorianCalendar doesn't handle the case that daylight saving time transitions happen at 0:00 (midnight). In the Brazil case, the standard-to-daylight transition happens at 0:00. Adding 1 day to its previous day at 0:00 produces 1:00 next day (transition day). However, add() tries to "adjust" the time to 0:00, and produces 23:00 of the previous day (the same day before the add() call). This problem was fixed along with the 4958050 fix in 1.5.0 and later.
2008-10-31