2003-04-19 Tom Tromey <tromey@redhat.com>
+ * java/sql/Date.java, java/sql/DriverManager.java,
+ java/sql/Time.java, java/sql/Timestamp.java: New versions from
+ Classpath.
+
* Makefile.in: Rebuilt.
* Makefile.am (ordinary_java_source_files): Added new files.
* java/security/AlgorithmParameterGenerator.java,
/* Date.java -- Wrapper around java.util.Date
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
package java.sql;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
}
/**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public int getHours() throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public int getMinutes() throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public int getSeconds() throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public void setHours(int newValue) throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public void setMinutes(int newValue) throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public void setSeconds(int newValue) throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
* This method returns a new instance of this class by parsing a
* date in JDBC format into a Java date.
*
*/
public static Date valueOf (String str)
{
- try
+ try
{
java.util.Date d = (java.util.Date) sdf.parseObject(str);
- return(new Date(d.getTime()));
+
+ if (d == null)
+ throw new IllegalArgumentException(str);
+ else
+ return new Date(d.getTime());
}
- catch(Exception e)
+ catch (ParseException e)
{
- return(null);
+ throw new IllegalArgumentException(str);
}
}
/* DriverManager.java -- Manage JDBC drivers
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
{
Class.forName(driver_classname); // The driver registers itself
}
- catch (Exception e) { ; } // Ignore not founds
+ catch (Exception e)
+ {
+ // Ignore not founds
+ }
}
}
* @param url The JDBC URL string to find a driver for.
*
* @return A <code>Driver</code> that can connect to the specified
- * URL, or <code>null</code> if a suitable driver cannot be found.
+ * URL.
*
- * @exception SQLException If an error occurs.
+ * @exception SQLException If an error occurs, or no suitable driver can be found.
*/
public static Driver getDriver(String url) throws SQLException
{
return d;
}
- return null;
+ throw new SQLException("No driver found for " + url);
}
/**
/* Time.java -- Wrapper around java.util.Date
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
package java.sql;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
*/
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public int getDate() throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public int getDay() throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public int getMonth() throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public int getYear() throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public void setDate(int newValue) throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public void setMonth(int newValue) throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * This method always throws an IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException when it's called.
+ * @deprecated
+ */
+ public void setYear(int newValue) throws IllegalArgumentException
+ {
+ throw new IllegalArgumentException();
+ }
/**
* This method returns a new instance of this class by parsing a
try
{
java.util.Date d = (java.util.Date) sdf.parseObject(str);
- return new Time(d.getTime());
+
+ if (d == null)
+ throw new IllegalArgumentException(str);
+ else
+ return new Time(d.getTime());
}
- catch (Exception e)
+ catch (ParseException e)
{
- return null;
+ throw new IllegalArgumentException(str);
}
}
package java.sql;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
try
{
Date d = (Date) parse_sdf.parseObject(str);
- return new Timestamp(d.getTime());
+
+ if (d == null)
+ throw new IllegalArgumentException(str);
+ else
+ return new Timestamp(d.getTime());
}
- catch (Exception e)
+ catch (ParseException e)
{
- return null;
+ throw new IllegalArgumentException(str);
}
}