From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17352 invoked by alias); 23 Mar 2002 01:36:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 17263 invoked by uid 71); 23 Mar 2002 01:36:00 -0000 Resent-Date: 23 Mar 2002 01:36:00 -0000 Resent-Message-ID: <20020323013600.17262.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, msmith@spinnakernet.com Received:(qmail 16090 invoked by uid 61); 23 Mar 2002 01:33:09 -0000 Message-Id:<20020323013309.16089.qmail@sources.redhat.com> Date: Fri, 22 Mar 2002 17:36:00 -0000 From: msmith@spinnakernet.com Reply-To: msmith@spinnakernet.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libgcj/6045: GregorianCalendar: getMinimum() and getMaximum() incorrect for month X-SW-Source: 2002-03/txt/msg00866.txt.bz2 List-Id: >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: