commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] [bug #13191] java.util.Calendar broken with certain operatio


From: Chuck Williams
Subject: [commit-cp] [bug #13191] java.util.Calendar broken with certain operations
Date: Thu, 26 May 2005 04:39:40 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13191>

                 Summary: java.util.Calendar broken with certain operations
                 Project: classpath
            Submitted by: manawiz
            Submitted on: Thu 05/26/2005 at 04:39
                Category: classpath
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
        Platform Version: Windows XP

    _______________________________________________________

Details:

The following sequence of statements illustrates a bug in Calendar:

DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
Calendar cal = Calendar.getInstance();
cal.set(2005, 4, 25, 20, 50, 30);
cal.set(Calendar.MILLISECOND, 333);
Date date = cal.getTime();
Calendar ccal = Calendar.getInstance();
ccal.setTime(new Date(date.getTime()));
System.out.println(df.format(ccal.getTime()));
ccal.set(Calendar.MONTH, 0);
System.out.println(df.format(ccal.getTime()));

The output is:

2005-05-25 20:50:30:333
1970-01-01 00:00:00:000

But should be:

2005-05-25 20:50:30:333
2005-01-25 20:50:30:333

Many variations of the above work.  I encountered this from a failing Lucene
JUnit test.  Other that this, Lucene works with GNU Classpath.  However, the
above breaks Lucene's DateTools, which are routinely used for time-tagging
indexed documents.







    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13191>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]