Re: [kaffe] Bug in Kaffe 1.0.7

2003-07-27 Thread Dalibor Topic
Hi Ito,

Ito Kazumitsu wrote:
In message "Re: [kaffe] Bug in Kaffe 1.0.7"
on 03/07/27, Ito Kazumitsu <[EMAIL PROTECTED]> writes:

Today (it is Sun Jul 27 07:33:35 JST 2003), both kaffe and Sun's JDK
gave the same results.


Having tested various cases, I have got an idea that we should import
GNU Classpath's java.util.Calendar and its relatives.
GNU Classpath's java.util.Calendar also gives results different 
from those of Sun's,  but it seems by far the better than kaffe's.

The attached program prints week-related values for the dates
from Jan 1 2000 to Dec 31 2003.  Both GNU Classpath and Sun's
JDK give identical results for the following months:
   Oct 2000, Apr 2001, Jul 2001, Sep 2002, Dec 2002, Jun 2003

On the other hand, kaffe's java.util.Calendar produces very
strange results:  adding one day to Jan 31 makes Jan 32 and
so on and Feburary never comes.
I am afraid correcting kaffe's java.util.Calendar and
java.util.GregorianCalendar is very hard and fruitless.
It was easy for me to import GNU Classpath's java.util.Calendar and
its relatives to kaffe.  I just copied java/util/Calendar.java,
java/util/GregorianCalendar.java and gnu/java/locale/Calendar*
thanks for looking at it, please go ahead and merge it in.

I attempted a rewrite of kaffe's Calendar and GregorianClaender classes 
a while ago, but it turned out to be quite hard to get it right. Since 
Classpath's classes work better, we should use them.

cheers,
dalibor topic
___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


Re: [kaffe] Bug in Kaffe 1.0.7

2003-07-27 Thread Ito Kazumitsu

In message "Re: [kaffe] Bug in Kaffe 1.0.7"
on 03/07/28, Ito Kazumitsu <[EMAIL PROTECTED]> writes:

> The attached program prints week-related values for the dates
> from Jan 1 2000 to Dec 31 2003.  Both GNU Classpath and Sun's
> JDK give identical results for the following months:
> 
>Oct 2000, Apr 2001, Jul 2001, Sep 2002, Dec 2002, Jun 2003

These months are special in that the first day of the month is Sunday.

The attached patch makes GNU classpath's java.util.Calendar behave
almost similarly to Sun's JDK except that the former returns 53 or
54 as the last week of the year but the latter returns 1.   I think
that returning 1 as the last week of the year may be a bug of Sun's
JDK.

I will submit this patch to the GNU Classpath mailing list.

--- java/util/GregorianCalendar.java.orig   Sun Mar 24 01:10:15 2002
+++ java/util/GregorianCalendar.javaMon Jul 28 11:53:16 2003
@@ -599,7 +599,7 @@
 // which day of the week are we (0..6), relative to getFirstDayOfWeek
 int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7;
 
-fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 6) / 7;
+fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7;
 
 int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7;
 

___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


Re: [kaffe] Bug in Kaffe 1.0.7

2003-07-27 Thread Ito Kazumitsu
In message "Re: [kaffe] Bug in Kaffe 1.0.7"
on 03/07/27, Ito Kazumitsu <[EMAIL PROTECTED]> writes:

> Today (it is Sun Jul 27 07:33:35 JST 2003), both kaffe and Sun's JDK
> gave the same results.

Having tested various cases, I have got an idea that we should import
GNU Classpath's java.util.Calendar and its relatives.

GNU Classpath's java.util.Calendar also gives results different 
from those of Sun's,  but it seems by far the better than kaffe's.

The attached program prints week-related values for the dates
from Jan 1 2000 to Dec 31 2003.  Both GNU Classpath and Sun's
JDK give identical results for the following months:

   Oct 2000, Apr 2001, Jul 2001, Sep 2002, Dec 2002, Jun 2003

On the other hand, kaffe's java.util.Calendar produces very
strange results:  adding one day to Jan 31 makes Jan 32 and
so on and Feburary never comes.

I am afraid correcting kaffe's java.util.Calendar and
java.util.GregorianCalendar is very hard and fruitless.

It was easy for me to import GNU Classpath's java.util.Calendar and
its relatives to kaffe.  I just copied java/util/Calendar.java,
java/util/GregorianCalendar.java and gnu/java/locale/Calendar*

Attaced program:

import java.util.*;
public class CalendarTest2 {
  public static void main(String[] args) {
Calendar c = Calendar.getInstance();
c.set(2000,0,1);
for (;c.get(Calendar.YEAR) < 2004; c.add(Calendar.DATE, 1)) {
  System.out.print(c.get(Calendar.YEAR) + "-" +
   (c.get(Calendar.MONTH) + 1) + "-" +
   c.get(Calendar.DAY_OF_MONTH) + ",");
  System.out.print(c.get(Calendar.DAY_OF_WEEK) + ",");
  System.out.print(c.get(Calendar.DAY_OF_YEAR) + ",");
  System.out.print(c.get(Calendar.WEEK_OF_YEAR) + ",");
  System.out.print(c.get(Calendar.WEEK_OF_MONTH) + ",");
  System.out.print(c.get(Calendar.DAY_OF_WEEK_IN_MONTH) + ",");
  System.out.println();
}
  }
}

___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


Re: [kaffe] Bug in Kaffe 1.0.7

2003-07-26 Thread Ito Kazumitsu
> "*" == Ito Kazumitsu <[EMAIL PROTECTED]> writes:

*> This is my test program and results.

*> With kaffe (ChangeLog head: 2003-07-20 Fabio.di.Fabio <[EMAIL PROTECTED]>):
*> MONTH=6
*> WEEK_OF_YEAR=31
*> WEEK_OF_MONTH=5
*> DAY_OF_YEAR=207
*> DAY_OF_MONTH=26
*> DAY_OF_WEEK_IN_MONTH=3
*> DAY_OF_WEEK=7
*> HOUR=8
*> HOUR_OF_DAY=8

*> With Sun's (java full version "1.4.2-b28"):
*> MONTH=6
*> WEEK_OF_YEAR=30
*> WEEK_OF_MONTH=4
*> DAY_OF_YEAR=207
*> DAY_OF_MONTH=26
*> DAY_OF_WEEK_IN_MONTH=4
*> DAY_OF_WEEK=7
*> HOUR=8
*> HOUR_OF_DAY=8

Today (it is Sun Jul 27 07:33:35 JST 2003), both kaffe and Sun's JDK
gave the same results.

With kaffe (ChangeLog head: 2003-07-20 Fabio.di.Fabio <[EMAIL PROTECTED]>):
MONTH=6
WEEK_OF_YEAR=31
WEEK_OF_MONTH=5
DAY_OF_YEAR=208
DAY_OF_MONTH=27
DAY_OF_WEEK_IN_MONTH=4
DAY_OF_WEEK=1
HOUR=7
HOUR_OF_DAY=7

With Sun's (java full version "1.4.2-b28"):
MONTH=6
WEEK_OF_YEAR=31
WEEK_OF_MONTH=5
DAY_OF_YEAR=208
DAY_OF_MONTH=27
DAY_OF_WEEK_IN_MONTH=4
DAY_OF_WEEK=1
HOUR=7
HOUR_OF_DAY=7

___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


Re: [kaffe] Bug in Kaffe 1.0.7

2003-07-25 Thread Ito Kazumitsu
> ":" == Clemens Eisserer <[EMAIL PROTECTED]> writes:

:> I´ve found a bug in Kaffe 1.0.7 (sorry, was not ablt to test 1.1.0) 
:> related to Calendar:
:> Dont know if its fixed, so please could you verify this bug on 1.1.0

With the CVS version of 2003-07-20,  the same problem occurs.

This is my test program and results.

import java.util.Calendar;
public class CalendarTest {
  public static void main(String[] args) {
Calendar c = Calendar.getInstance();
System.out.println("MONTH=" + c.get(Calendar.MONTH));
System.out.println("WEEK_OF_YEAR=" + c.get(Calendar.WEEK_OF_YEAR));
System.out.println("WEEK_OF_MONTH=" + c.get(Calendar.WEEK_OF_MONTH));
System.out.println("DAY_OF_YEAR=" + c.get(Calendar.DAY_OF_YEAR));
System.out.println("DAY_OF_MONTH=" + c.get(Calendar.DAY_OF_MONTH));
System.out.println("DAY_OF_WEEK_IN_MONTH=" + c.get(Calendar.DAY_OF_WEEK_IN_MONTH));
System.out.println("DAY_OF_WEEK=" + c.get(Calendar.DAY_OF_WEEK));
System.out.println("HOUR=" + c.get(Calendar.HOUR));
System.out.println("HOUR_OF_DAY=" + c.get(Calendar.HOUR_OF_DAY));
  }
}

With kaffe (ChangeLog head: 2003-07-20 Fabio.di.Fabio <[EMAIL PROTECTED]>):
MONTH=6
WEEK_OF_YEAR=31
WEEK_OF_MONTH=5
DAY_OF_YEAR=207
DAY_OF_MONTH=26
DAY_OF_WEEK_IN_MONTH=3
DAY_OF_WEEK=7
HOUR=8
HOUR_OF_DAY=8

With Sun's (java full version "1.4.2-b28"):
MONTH=6
WEEK_OF_YEAR=30
WEEK_OF_MONTH=4
DAY_OF_YEAR=207
DAY_OF_MONTH=26
DAY_OF_WEEK_IN_MONTH=4
DAY_OF_WEEK=7
HOUR=8
HOUR_OF_DAY=8

___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


[kaffe] Bug in Kaffe 1.0.7

2003-07-25 Thread Clemens Eisserer
Hi there!

I´ve found a bug in Kaffe 1.0.7 (sorry, was not ablt to test 1.1.0) 
related to Calendar:
Dont know if its fixed, so please could you verify this bug on 1.1.0

Calendar c = Calendar.getInstance();
int week = c.get(Calendar.WEEK_OF_YEAR);
Week is to low compared with the sun-jvm and my paperbook-calendar, it 
should be exactly 1 higher.
E.G. In the real week 29 kaffe tells me its week 28.

Hope that helps!

Mfg Clemens Eisserer



___
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe