jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r164226 - /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java
Date Fri, 22 Apr 2005 12:18:11 GMT
Author: stefan
Date: Fri Apr 22 05:18:10 2005
New Revision: 164226

URL: http://svn.apache.org/viewcvs?rev=164226&view=rev
Log:
fixed bug in setProperty(String, Value[], int):
inhomogeneous value types did not cause ValueFormatException to be thrown

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java?rev=164226&r1=164225&r2=164226&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/util/ValueHelper.java Fri
Apr 22 05:18:10 2005
@@ -100,8 +100,23 @@
         if (srcValues == null) {
             return null;
         }
+
         Value[] newValues = new Value[srcValues.length];
+        int srcValueType = PropertyType.UNDEFINED;
         for (int i = 0; i < srcValues.length; i++) {
+            if (srcValues[i] == null) {
+                newValues[i] = null;
+                continue;
+            }
+            // check type of values
+            if (srcValueType == PropertyType.UNDEFINED) {
+                srcValueType = srcValues[i].getType();
+            } else if (srcValueType != srcValues[i].getType()) {
+                // inhomogeneous types
+                String msg = "inhomogeneous type of values";
+                throw new ValueFormatException(msg);
+            }
+
             newValues[i] = convert(srcValues[i], targetType);
         }
         return newValues;



Mime
View raw message