A bit of OT, but this bug hit me in JDK1.1.7 (Sun/Solaris)
I would like to submit it to SUN.
Hi,
Pls be careful when using java.util.Calendar().
The following should return FRIDAY, but it returns some random day of the
week
Calendar tradeDate = Calendar.getInstance();
tradeDate.set(yyyy, mm-1, dd);
//tradeDate.setTime(tradeDate.getTime());
System.err.println("Tradedate is " + tradeDate.getTime() +
", DAY_OF_WEEK = " + tradeDate.get(Calendar.DAY_OF_WEEK));
Should print 6 for DAY_OF_WEEK (Friday). But it prints 0 (or some other
number)
The way to fix it is to uncomment the setTime() above!!!
Yikes!
--Olu E.
> -----Original Message-----
> From: Milt Epstein [SMTP:[EMAIL PROTECTED]]
> Sent: Saturday, August 14, 1999 5:44 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Static and non-static methods in servlets
>
> On Sat, 14 Aug 1999, hhito wrote:
>
> [ ... ]
> > This gives other servlets access to the same services simply by
> > calling MyServlet.performService(). This saves me from messing with
> > getServlet(). Are there any syncronization issues invloved here or
> > any other problems I'm not aware of?
>
> I can't offhand think of any problems this would cause. However, I
> also can't see why you'd want to do it this way, from an
> object-oriented design perspective. If the method is static, that
> means it doesn't really have anything to do with the specifics of that
> servlet per se, in which case it seems to me its job should be done by
> a non-servlet class. Think of your servlet(s) as the interface
> between the web and your application; you'd want to keep the
> application code as much out of the servlets as possible, and that
> would be the place for the functionality contained in that static
> method.
>
> Milt Epstein
> Research Programmer
> Software/Systems Development Group
> Computing and Communications Services Office (CCSO)
> University of Illinois at Urbana-Champaign (UIUC)
> [EMAIL PROTECTED]
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html