jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1330895 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
Date Thu, 26 Apr 2012 15:02:52 GMT
Author: angela
Date: Thu Apr 26 15:02:51 2012
New Revision: 1330895

URL: http://svn.apache.org/viewvc?rev=1330895&view=rev
Log:
OAK-16 : Proper ValueFactory implementation and Value handling (WIP)

- deal with NumberFormatException
- validate Date input

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java?rev=1330895&r1=1330894&r2=1330895&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueFactoryImpl.java
Thu Apr 26 15:02:51 2012
@@ -152,8 +152,17 @@ public class ValueFactoryImpl implements
             cv = factory.createValue(nameMapper.getOakName(value), type);
         } else if (type == PropertyType.PATH) {
             cv = factory.createValue(Paths.toOakPath(value, nameMapper), type);
-        } else {
+        } else if (type == PropertyType.DATE) {
+            if (ISO8601.parse(value) == null) {
+                throw new ValueFormatException("Invalid date " + value);
+            }
             cv = factory.createValue(value, type);
+        } else {
+            try {
+                cv = factory.createValue(value, type);
+            } catch (NumberFormatException e) {
+                throw new ValueFormatException("Invalid value " + value + " for type " +
PropertyType.nameFromValue(type));
+            }
         }
 
         return new ValueImpl(cv, nameMapper);



Mime
View raw message