United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4741930 REGRESSION: Incorrent time zone parsing/error reporting
4741930 : REGRESSION: Incorrent time zone parsing/error reporting

Details
Type:
Bug
Submit Date:
2002-09-05
Status:
Closed
Updated Date:
2002-09-06
Project Name:
JDK
Resolved Date:
2002-09-06
Component:
core-libs
OS:
windows_2000
Sub-Component:
java.util:i18n
CPU:
x86
Priority:
P3
Resolution:
Not an Issue
Affected Versions:
1.4.1
Fixed Versions:

Related Reports
Relates:

Sub Tasks

Description

Name: gm110360			Date: 09/04/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-
root_02_may_2002_02_43)
Java HotSpot(TM) Client VM (build 1.4, mixed mode)


windows 2000,
Also repeatable on MacOS



A DESCRIPTION OF THE PROBLEM :
When using java.util.TimeZone.getTimeZone() method
with "Etc/GMT+2" parameter I expect to receive either GMT
time zone because it could not be parser, or time zone with
-2 hours offset from GMT. What I do receive is timezone with
-1 offset from GMT!


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run enclosed code example.
Compare expected and actual results.


EXPECTED VERSUS ACTUAL BEHAVIOR :
Actual Results:

Etc/GMT-2 offset = 7200000
Etc/GMT+2 offset = -7200000
GMT+2 offset = 7200000
Europe/Kiev offset = 7200000

Expected Results:

Etc/GMT-2 offset = 0 or -720000
Etc/GMT+2 offset = 0 or 720000
GMT+2 offset = 7200000
Europe/Kiev offset = 7200000



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.util.TimeZone;

public class tztest
{
    public static void main(String []args)
    {
        TimeZone  tz1 = TimeZone.getTimeZone("Etc/GMT-2");
        TimeZone  tz2 = TimeZone.getTimeZone("Etc/GMT+2");
        TimeZone  tz3 = TimeZone.getTimeZone("GMT+2");
        TimeZone  tz4 = TimeZone.getTimeZone("Europe/Kiev");
        
        System.out.println("Etc/GMT-2 offset = "   + tz1.getRawOffset() );
        System.out.println("Etc/GMT+2 offset = "   + tz2.getRawOffset() );
        System.out.println("GMT+2 offset = "       + tz3.getRawOffset() );
        System.out.println("Europe/Kiev offset = " + tz4.getRawOffset() );
    }
}


---------- END SOURCE ----------

CUSTOMER WORKAROUND :
work around is to use correct time zone name.
However it is not always possible, for example in cases when
it is typed by the user.

Release Regression From : 1.3.1_04
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 164029) 
======================================================================

                                    

Comments
EVALUATION

Etc/GMT+/-* time zones are supported since 1.4. (See 4495052) They have the opposite signs for time zone offsets (UNIX-style).

In Desription, I'm not sure about receiving -1. The actual results given in Description show all -2 or 2. The actual output of the program in Description is:

Etc/GMT-2 offset = 7200000
Etc/GMT+2 offset = -7200000
GMT+2 offset = 7200000
Europe/Kiev offset = 7200000

which is consistent with the actual results. Note that GMT+2 is a custom time zone ID in TimeZone.
###@###.### 2002-09-06
                                     
2002-09-06



Hardware and Software, Engineered to Work Together