public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "mnefedov at rogers dot com" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/18083] New: Calendar returns incorrect values for DAY_OF_YEAR and DAY_OF_WEEK after calling add().
Date: Wed, 20 Oct 2004 15:52:00 -0000	[thread overview]
Message-ID: <20041020155232.18083.mnefedov@rogers.com> (raw)

Calendar returns incorrect values for DAY_OF_YEAR and DAY_OF_WEEK after 
calling add().

Here is an example code to test it:

import java.util.Calendar;

public class CalendarTest {
	public static void main( String [] args ) {
		boolean fail = false;
		Calendar c = Calendar.getInstance();

		c.set( 2004, 0, 1 );
		fail |= print( c, 1, 5 );

		c.add( Calendar.MONTH, 1 );
		fail |= print( c, 32, 1 );

		c.add( Calendar.MONTH, 1 );
		fail |= print( c, 61, 2 );

		c.add( Calendar.MONTH, 1 );
		fail |= print( c, 92, 5 );

		System.exit( fail ? 1 : 0 );

	}
	static boolean print( Calendar c, int doy, int dow ) {
		int y = c.get( Calendar.YEAR ), 
		    m = c.get( Calendar.MONTH ), 
		    d = c.get( Calendar.DAY_OF_MONTH ), 
		    actdoy = c.get( Calendar.DAY_OF_YEAR ), 
		    actdow = c.get( Calendar.DAY_OF_WEEK );

		if( actdoy != doy || actdow != dow ) {
			System.out.println( "FAIL: y="+y+", m="+m+", d="+d+", 
doy="+doy+", actdoy="+actdoy+", dow="+dow+", actdow="+actdow );
			return true;
		} else {
			System.out.println( "PASS: y="+y+", m="+m+", d="+d+", 
doy="+doy+", dow="+dow);
			return false;
		}
	}
}

-- 
           Summary: Calendar returns incorrect values for DAY_OF_YEAR and
                    DAY_OF_WEEK after calling add().
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mnefedov at rogers dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18083


             reply	other threads:[~2004-10-20 15:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-20 15:52 mnefedov at rogers dot com [this message]
2004-10-20 17:19 ` [Bug libgcj/18083] " pinskia at gcc dot gnu dot org
2004-10-20 17:33 ` mnefedov at rogers dot com
2004-10-20 19:16 ` pinskia at gcc dot gnu dot org
2005-03-23 21:36 ` cvs-commit at gcc dot gnu dot org
2005-03-23 21:37 ` cvs-commit at gcc dot gnu dot org
2005-03-23 21:39 ` tromey at gcc dot gnu dot org

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=20041020155232.18083.mnefedov@rogers.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@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: link
Be 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).