United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6765739 : The java 1.4.2_15 Calendar add(DAY_OF_YEAR, 1) does not always increment the date for Brazil TZ.

Details
Type:
Bug
Submit Date:
2008-10-30
Status:
Closed
Updated Date:
2010-12-07
Project Name:
JDK
Resolved Date:
2009-03-30
Component:
core-libs
OS:
generic
Sub-Component:
java.util:i18n
CPU:
generic
Priority:
P1
Resolution:
Fixed
Affected Versions:
1.4.2_15
Fixed Versions:
1.4.2_20-rev (b05)

Related Reports
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

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



Hardware and Software, Engineered to Work Together