public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/17002] java.util.TimeZone.getDefault() is broken
  2004-08-12 13:39 [Bug libgcj/17002] New: java.util.TimeZone.getDefault() is broken mark at gcc dot gnu dot org
@ 2004-08-12 13:39 ` mark at gcc dot gnu dot org
  2004-08-26 16:11 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mark at gcc dot gnu dot org @ 2004-08-12 13:39 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |16990
              nThis|                            |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-12 13:39:51
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17002


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/17002] New: java.util.TimeZone.getDefault() is broken
@ 2004-08-12 13:39 mark at gcc dot gnu dot org
  2004-08-12 13:39 ` [Bug libgcj/17002] " mark at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mark at gcc dot gnu dot org @ 2004-08-12 13:39 UTC (permalink / raw)
  To: java-prs

TimeZone.getDefault() has two bugs mapping short timezone names (plus
GMT-offset) to long/display timezone information.

- The interface between getDefault() and the native getDefaultTimeZoneId() is
unclear. Which means that the result of getDefaultTimeZoneId() is not always
mapped to the correct TimeZone.

- getDefaultTimeZoneId() should always return the standard (std) short timezone
name, never the alternative (dst) Daylight Savings Time name. When it returns a
dst name the getDefault() mapping from short name to long/display timezone name
also breaks.

-- 
           Summary: java.util.TimeZone.getDefault() is broken
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: mark at klomp dot org
        ReportedBy: mark at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17002


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/17002] java.util.TimeZone.getDefault() is broken
  2004-08-12 13:39 [Bug libgcj/17002] New: java.util.TimeZone.getDefault() is broken mark at gcc dot gnu dot org
  2004-08-12 13:39 ` [Bug libgcj/17002] " mark at gcc dot gnu dot org
@ 2004-08-26 16:11 ` cvs-commit at gcc dot gnu dot org
  2004-08-26 18:22 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-26 16:11 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-26 16:11 -------
Subject: Bug 17002

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mark@gcc.gnu.org	2004-08-26 16:10:54

Modified files:
	libjava        : ChangeLog 
	libjava/java/util: TimeZone.java natTimeZone.cc 

Log message:
	2004-08-26  Mark Wielaard  <mark@klomp.org>
	
	Fixes PR libgcj/17002:
	* java/util/TimeZone.java (defaultZone): Try a couple of ways to get
	a TimeZoneId string and then try to convert that to a TimeZone with
	getDefaultSystemTimeZone(String).
	(timezones0): Changed type from Hashtable to HashMap.
	(timezones): Create HashMap, not Hashtable.
	(getDefaultTimeZone): New method, rewritten from CNI version.
	(readTimeZoneFile): New method.
	(readtzFile): Likewise.
	(skipFully): Likewise.
	* java/util/natTimeZone.cc (getSystemTimeZone): Renamed to
	getDefaultTimeZoneId and rewritten.
	(getDefaultTimeZoneId): Rewritten in java.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3020&r2=1.3021
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/TimeZone.java.diff?cvsroot=gcc&r1=1.18&r2=1.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/natTimeZone.cc.diff?cvsroot=gcc&r1=1.6&r2=1.7



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17002


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/17002] java.util.TimeZone.getDefault() is broken
  2004-08-12 13:39 [Bug libgcj/17002] New: java.util.TimeZone.getDefault() is broken mark at gcc dot gnu dot org
  2004-08-12 13:39 ` [Bug libgcj/17002] " mark at gcc dot gnu dot org
  2004-08-26 16:11 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-26 18:22 ` pinskia at gcc dot gnu dot org
  2004-08-26 19:43 ` mckinlay at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-26 18:22 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-26 18:22 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17002


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/17002] java.util.TimeZone.getDefault() is broken
  2004-08-12 13:39 [Bug libgcj/17002] New: java.util.TimeZone.getDefault() is broken mark at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-08-26 18:22 ` pinskia at gcc dot gnu dot org
@ 2004-08-26 19:43 ` mckinlay at redhat dot com
  2004-08-26 20:34 ` mark at klomp dot org
  2004-08-26 21:08 ` mckinlay at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: mckinlay at redhat dot com @ 2004-08-26 19:43 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-08-26 19:43 -------
Unfortunately, this isn't yet fixed for some platforms, such as Fedora Core 2. 

FC2 does not set the TZ environment variable, and it does not have an
/etc/timezone file. 

Here's the test case:

import java.util.TimeZone;

public class TZ2
{
  public static void main(String[] args)
  {
    TimeZone tz = TimeZone.getDefault();
    System.out.println (tz.getID());
  }
}

$ java TZ2
America/Toronto

$ gij TZ2
EST

I straced Sun's JVM to see if I could tell how it was getting the timezone ID:

open("/etc/sysconfig/clock", O_RDONLY)  = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=42, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xea75d000
read(4, "ZONE=\"America/Toronto\"\nUTC=true\n"..., 4096) = 42
close(4)                                = 0

Looks like we need to try the /etc/sysconfig/clock file also?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17002


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/17002] java.util.TimeZone.getDefault() is broken
  2004-08-12 13:39 [Bug libgcj/17002] New: java.util.TimeZone.getDefault() is broken mark at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-08-26 19:43 ` mckinlay at redhat dot com
@ 2004-08-26 20:34 ` mark at klomp dot org
  2004-08-26 21:08 ` mckinlay at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: mark at klomp dot org @ 2004-08-26 20:34 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mark at klomp dot org  2004-08-26 20:34 -------
Subject: Re:  java.util.TimeZone.getDefault() is broken

Hi,

On Thu, 2004-08-26 at 21:43, mckinlay at redhat dot com wrote:
> ------- Additional Comments From mckinlay at redhat dot com  2004-08-26 19:43 -------
> Unfortunately, this isn't yet fixed for some platforms, such as Fedora Core 2. 
> 
> FC2 does not set the TZ environment variable, and it does not have an
> /etc/timezone file. 

Even so, if the system property user.timezone isn't set, the TZ
environment variable isn't set, there isn't a /etc/timezone, and not
/etc/localtime then we still have the libc/posix way of getting the time
zone information.

> Here's the test case:
> 
> import java.util.TimeZone;
> 
> public class TZ2
> {
>   public static void main(String[] args)
>   {
>     TimeZone tz = TimeZone.getDefault();
>     System.out.println (tz.getID());
>   }
> }
> 
> $ java TZ2
> America/Toronto
> 
> $ gij TZ2
> EST

Isn't EST correct for Toronto?
You only print the ID not the whole timezone information. Please check
all information of the given timezone and see if any of that information
is incorrect for you system.

Maybe you think that the ID should be different but I think this is not
covered by this bug. Please see the TimeZone meta bug for an overview of
other issues with TimeZone [Bug libgcj/16990].

Thanks,

Mark


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17002


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/17002] java.util.TimeZone.getDefault() is broken
  2004-08-12 13:39 [Bug libgcj/17002] New: java.util.TimeZone.getDefault() is broken mark at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-08-26 20:34 ` mark at klomp dot org
@ 2004-08-26 21:08 ` mckinlay at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: mckinlay at redhat dot com @ 2004-08-26 21:08 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-08-26 21:08 -------
Yes, afaik the other contents of the returned TimeZone are correct. However, as
an ID, "EST" is just a display name, it doesn't canonically identify any
particular time zone. Note that the spec says that the use of these three-letter
IDs to represent time zones is deprecated.

I agree that this is not the same issue as the original bug report, though. I'll
close this and file a new bug.

Thanks Mark

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17002


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-08-26 21:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-12 13:39 [Bug libgcj/17002] New: java.util.TimeZone.getDefault() is broken mark at gcc dot gnu dot org
2004-08-12 13:39 ` [Bug libgcj/17002] " mark at gcc dot gnu dot org
2004-08-26 16:11 ` cvs-commit at gcc dot gnu dot org
2004-08-26 18:22 ` pinskia at gcc dot gnu dot org
2004-08-26 19:43 ` mckinlay at redhat dot com
2004-08-26 20:34 ` mark at klomp dot org
2004-08-26 21:08 ` mckinlay at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).