cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r439468 - in /incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types: CalendarType.java UtilDateType.java
Date Fri, 01 Sep 2006 20:30:37 GMT
Author: aadamchik
Date: Fri Sep  1 13:30:36 2006
New Revision: 439468

URL: http://svn.apache.org/viewvc?rev=439468&view=rev
Log:
CAY-645 - better error diagnostics

Modified:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/CalendarType.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/UtilDateType.java

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/CalendarType.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/CalendarType.java?rev=439468&r1=439467&r2=439468&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/CalendarType.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/CalendarType.java
Fri Sep  1 13:30:36 2006
@@ -27,6 +27,7 @@
 import java.util.GregorianCalendar;
 
 import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.dba.TypesMapping;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.validation.ValidationResult;
 
@@ -168,9 +169,11 @@
         else if (type == Types.TIMESTAMP)
             return new java.sql.Timestamp(calendar.getTimeInMillis());
         else
-            throw new IllegalArgumentException("Only date/time types can be used for '"
-                    + getClassName()
-                    + "'.");
+            throw new IllegalArgumentException(
+                    "Only DATE, TIME or TIMESTAMP can be mapped as '"
+                            + getClassName()
+                            + "', got "
+                            + TypesMapping.getSqlNameByType(type));
     }
 
     public boolean validateProperty(

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/UtilDateType.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/UtilDateType.java?rev=439468&r1=439467&r2=439468&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/UtilDateType.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/types/UtilDateType.java
Fri Sep  1 13:30:36 2006
@@ -68,9 +68,11 @@
         else if (type == Types.TIMESTAMP)
             return new java.sql.Timestamp(((Date) val).getTime());
         else
-            throw new IllegalArgumentException("Only date/time types can be used for '"
-                    + getClassName()
-                    + "'.");
+            throw new IllegalArgumentException(
+                    "Only DATE, TIME or TIMESTAMP can be mapped as '"
+                            + getClassName()
+                            + "', got "
+                            + TypesMapping.getSqlNameByType(type));
     }
 
     public Object materializeObject(ResultSet rs, int index, int type) throws Exception {



Mime
View raw message