Fwd: Re: [kaffe] java.sql.*

Ito Kazumitsu ito.kazumitsu at hitachi-cable.co.jp
Thu Apr 10 04:40:01 PDT 2003


Hi,

In message "Re: Fwd: Re: [kaffe] java.sql.*"
    on 03/04/10, Dalibor Topic <robilad at yahoo.com> writes:

> Could you write testcases DriverManager & Date and see
> how Sun's JDK
> behaves ? I'll take care of the missing get methods.

OK,  here is the results.  The test program is attached below.

                                Sun's JDK   Kaffe     Kaffe+GNU Classpath
                                ---------   -------   -------------------
Date.valueOf("Strange")         IAE         IAE       null
Time.valueOf("Strange")         IAE         IAE       null
Timestamp.valueOf("Strange")    IAE         IAE       null
Date.getHours()                 IAE         0         0
DriverManager.getDriver("NA")   SQLE        SQLE      null

                                IAE: IllegalArgumentException
                                SQLE: SQLException

According to Sun's API document,  Date.getHours() must always
throw IllegalArgumentException. So both kaff and GNU classpath's
Date.getHours() is wrong.  Both kaff and GNU classpath's
Date.getHours() seem to be calling super.getHours(), that is
java.util.Date.getHours().

I compiled the following program with Sun's javac, kaffe's
kjc using kaffe's java.sql and kaffe's kjc using GNU classpath's
java.sql.  The results were all the same.

import java.sql.*;

public class TestSQLMisc {

    public static void main(String[] args) {

        try {
            Date date = Date.valueOf("StrangeDate");
            System.err.println("date=" + date);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        try {
            Time time = Time.valueOf("StrangeTime");
            System.err.println("time=" + time);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        try {
            Timestamp ts = Timestamp.valueOf("StrangeTimestamp");
            System.err.println("timestamp=" + ts);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        try {
            Date date = Date.valueOf("2003-04-10");
            int h = date.getHours();
            System.err.println("hours=" + h);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        try {
            Driver d = DriverManager.getDriver("jdbc:hsqldb:nonexsistent");
            System.err.println("driver=" + d);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

    }
}




More information about the kaffe mailing list