diff options
| author | Brian Jones <cbj@gnu.org> | 2003-04-11 22:01:07 +0000 |
|---|---|---|
| committer | Brian Jones <cbj@gnu.org> | 2003-04-11 22:01:07 +0000 |
| commit | a2cf7c59e7fdacd2aaa9a38d5bb1049223f40c41 (patch) | |
| tree | 08c8be9ea35af1effe254fd3ce3cae6babd3e5e8 /java/sql/Time.java | |
| parent | 796a9d86f8f25073cc0a702921c4469fbc6791c2 (diff) | |
| download | classpath-a2cf7c59e7fdacd2aaa9a38d5bb1049223f40c41.tar.gz | |
2003-04-11 Dalibor Topic <robilad@yahoo.com>
* java/sql/Date.java: imported java.text.ParseException.
(getHours, getMinutes, getSeconds, setHours, setMinutes,
setSeconds) new methods.
* java/sql/Time.java:
(getDate, getDay, getMonts, getYear, setDate, setMonth, setYear):
new methods.
* java/sql/Date.java, java/sql/Time.java,
java/sql/Timestamp.java: imported java.text.ParseException.
(valueOf) throw an IllegalArgumentException if argument can't
be parsed.
* java/sql/DriverManager.java
(getDriver) throw an SQLException if no driver can be found.
All reported by: Ito Kazumitsu <ito.kazumitsu@hitachi-cable.co.jp>
Diffstat (limited to 'java/sql/Time.java')
| -rw-r--r-- | java/sql/Time.java | 82 |
1 files changed, 79 insertions, 3 deletions
diff --git a/java/sql/Time.java b/java/sql/Time.java index 7d515c25c..ca1510bf1 100644 --- a/java/sql/Time.java +++ b/java/sql/Time.java @@ -38,6 +38,7 @@ exception statement from your version. */ package java.sql; +import java.text.ParseException; import java.text.SimpleDateFormat; /** @@ -55,6 +56,75 @@ public class Time extends java.util.Date */ 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 +140,17 @@ public class Time extends java.util.Date 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); } } |
