This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: java.sql merge


I'm checking this in to the trunk.

This brings over some java.sql fixes from Classpath.

Tom

Index: libjava/ChangeLog
from  Tom Tromey  <tromey at redhat dot com>
	* java/sql/Date.java, java/sql/DriverManager.java,
	java/sql/Time.java, java/sql/Timestamp.java: New versions from
	Classpath.

Index: libjava/java/sql/Date.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/sql/Date.java,v
retrieving revision 1.5
diff -u -r1.5 Date.java
--- libjava/java/sql/Date.java 31 Mar 2003 12:14:53 -0000 1.5
+++ libjava/java/sql/Date.java 19 Apr 2003 21:16:48 -0000
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -37,6 +37,7 @@
 
 package java.sql;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 
 /**
@@ -82,6 +83,72 @@
   }
 
   /**
+   * 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.
    *
@@ -92,14 +159,18 @@
    */
   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);
       }
   }
 
Index: libjava/java/sql/DriverManager.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/sql/DriverManager.java,v
retrieving revision 1.6
diff -u -r1.6 DriverManager.java
--- libjava/java/sql/DriverManager.java 21 Jun 2002 05:39:23 -0000 1.6
+++ libjava/java/sql/DriverManager.java 19 Apr 2003 21:16:48 -0000
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -103,7 +103,10 @@
               {
         	Class.forName(driver_classname); // The driver registers itself
               }
-            catch (Exception e) { ; } // Ignore not founds
+            catch (Exception e)
+	      {
+		// Ignore not founds
+	      }
           }
       }
 
@@ -209,9 +212,9 @@
    * @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
   {
@@ -224,7 +227,7 @@
           return d;
       }
 
-    return null;
+    throw new SQLException("No driver found for " + url);
   }
 
   /**
Index: libjava/java/sql/Time.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/sql/Time.java,v
retrieving revision 1.5
diff -u -r1.5 Time.java
--- libjava/java/sql/Time.java 31 Mar 2003 12:14:53 -0000 1.5
+++ libjava/java/sql/Time.java 19 Apr 2003 21:16:48 -0000
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -38,6 +38,7 @@
 
 package java.sql;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 
 /**
@@ -55,6 +56,82 @@
    */
   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
@@ -70,11 +147,15 @@
     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);
       }
   }
 
Index: libjava/java/sql/Timestamp.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/sql/Timestamp.java,v
retrieving revision 1.5
diff -u -r1.5 Timestamp.java
--- libjava/java/sql/Timestamp.java 10 Feb 2003 19:56:12 -0000 1.5
+++ libjava/java/sql/Timestamp.java 19 Apr 2003 21:16:49 -0000
@@ -38,6 +38,7 @@
 
 package java.sql;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 
 /**
@@ -81,11 +82,15 @@
     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);
       }
   }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]