public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: msmith@spinnakernet.com To: gcc-gnats@gcc.gnu.org Subject: libgcj/6045: GregorianCalendar: getMinimum() and getMaximum() incorrect for month Date: Fri, 22 Mar 2002 17:36:00 -0000 [thread overview] Message-ID: <20020323013309.16089.qmail@sources.redhat.com> (raw) >Number: 6045 >Category: libgcj >Synopsis: GregorianCalendar: getMinimum() and getMaximum() incorrect for month >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Mar 22 17:36:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Michael Smith >Release: gcj (GCC) 3.1 20020322 (prerelease) >Organization: >Environment: Linux msmith 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown >Description: The Java API specification for Calendar describe Months as zero-based. That means that getMinimum(Calendar.MONTH) should return 0. However, gcj is reporting 1. It would probably be ok for gcj to report 1 if it actually used 1 based months, but it's using 0 based months and still reporting 1 for getMinimum. Same problems with getMaximum (11 vs 12). >How-To-Repeat: [msmith@msmith cal]$ cat MonthMin.java import java.util.Date; import java.util.Calendar; public class MonthMin { public static void main(String args[]) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); int monthMin = cal.getMinimum(Calendar.MONTH); System.err.println("Minimum value for month: " + monthMin); // set the month to the minimum cal.set(Calendar.MONTH, monthMin); System.err.println("Month in this timestamp should be January: " + cal.getTime()); } } [msmith@msmith cal]$ java -version java version "1.3.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01) Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode) [msmith@msmith cal]$ javac MonthMin.java [msmith@msmith cal]$ java MonthMin Minimum value for month: 0 Month in this timestamp should be January: Tue Jan 22 20:23:35 EST 2002 [msmith@msmith cal]$ gcj --version gcj (GCC) 3.1 20020322 (prerelease) Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [msmith@msmith cal]$ gcj --main=MonthMin -o MonthMin MonthMin.java [msmith@msmith cal]$ ./MonthMin Minimum value for month: 1 Month in this timestamp should be January: Fri Feb 22 20:23:57 GMT-05:00 2002 >Fix: Index: GregorianCalendar.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/java/util/GregorianCalendar.java,v retrieving revision 1.15 diff -u -r1.15 GregorianCalendar.java --- GregorianCalendar.java 2002/01/22 22:40:38 1.15 +++ GregorianCalendar.java 2002/03/23 01:30:31 @@ -917,11 +917,11 @@ } private static final int[] minimums = - { BC, 1, 1, 0, 1, 1, 1, SUNDAY, 1, + { BC, 1, 0, 0, 1, 1, 1, SUNDAY, 1, AM, 1, 0, 1, 1, 1, -(12*60*60*1000), 0 }; private static final int[] maximums = - { AD, 5000000, 12, 53, 5, 31, 366, SATURDAY, 5, + { AD, 5000000, 11, 53, 5, 31, 366, SATURDAY, 5, PM, 12, 23, 59, 59, 999, +(12*60*60*1000), (12*60*60*1000) }; /** >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-03-23 1:36 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-03-22 17:36 msmith [this message] 2002-03-23 8:11 tromey 2002-03-23 19:26 Tom Tromey
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020323013309.16089.qmail@sources.redhat.com \ --to=msmith@spinnakernet.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).