You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Kevin DeSilva <er...@bigpond.com> on 2000/06/01 13:05:34 UTC

mod_jserv/6136: System Date does not work correctly on servlets

>Number:         6136
>Category:       mod_jserv
>Synopsis:       System Date does not work correctly on servlets
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jserv
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Jun 01 04:10:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     eresha@bigpond.com
>Release:        1.3.12
>Organization:
apache
>Environment:
aix 4.2.1, compiler gcc
>Description:
For some reason apache jserv does not appear to get the system date correctly. 
The following line of code in my servlet. 

Date curDate = new Date();

incorrectly reports yesterday's date until 10.00am after which it switches over to the correct date. For example if today is 31/5/00 the date reported in the class Date curDate = new Date() is 30/5/00 (until 10.00am). At first, I thought this may be a problem with my standard JVM installation so I tested a normal java application which works fine. Therefore, I guess, it must be something to do with JVM startup initialisation that mod_jserv does. 
>How-To-Repeat:
Try the following line of code in any servlet:

Date curDate = new Date();
System.out.println(curDate);
>Fix:
The problem must be to do with the way the JVM starts up (ie.timezone settings)-but the documentation does not help in fixing this apparent bug.
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]