summaryrefslogtreecommitdiff
path: root/java/sql/Date.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/sql/Date.java')
-rw-r--r--java/sql/Date.java75
1 files changed, 71 insertions, 4 deletions
diff --git a/java/sql/Date.java b/java/sql/Date.java
index 360376c25..1ba21a190 100644
--- a/java/sql/Date.java
+++ b/java/sql/Date.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package java.sql;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
@@ -82,6 +83,66 @@ public class Date extends java.util.Date
}
/**
+ * 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 +153,20 @@ public class Date extends java.util.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);
}
}