empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rei...@apache.org
Subject svn commit: r1196679 - /incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java
Date Wed, 02 Nov 2011 16:37:55 GMT
Author: reiher
Date: Wed Nov  2 16:37:55 2011
New Revision: 1196679

URL: http://svn.apache.org/viewvc?rev=1196679&view=rev
Log:
EMPIREDB-120 Added a length check of the given value to the DBTableColumn's checkValue(Object
value) method for DataType DATETIME/DATE, so an empty string leads to return true and not
to aFieldIllegalValueException.

Modified:
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java?rev=1196679&r1=1196678&r2=1196679&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java
(original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java
Wed Nov  2 16:37:55 2011
@@ -278,10 +278,15 @@ public class DBTableColumn extends DBCol
                 // Check whether value is a valid date/time value!
                 if (value!=null && (value instanceof Date)==false && value.equals(DBDatabase.SYSDATE)==false)
                 {   try
-                    {   // Parse date time value
-                        SimpleDateFormat sdFormat = new SimpleDateFormat("dd-MM-yyyy");
-                        sdFormat.setLenient(true);
-                        sdFormat.parse(value.toString());
+                    {   
+                		String val = value.toString();
+                		if (val.length() > 0)
+                		{
+	                		// Parse date time value
+	                        SimpleDateFormat sdFormat = new SimpleDateFormat("dd-MM-yyyy");
+	                        sdFormat.setLenient(true);
+	                        sdFormat.parse(value.toString());
+                		}	                        
                         // OK
                     } catch (ParseException e)
                     {   // Error



Mime
View raw message