jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: rev 57153 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core
Date Wed, 10 Nov 2004 12:52:28 GMT
Author: tripod
Date: Wed Nov 10 04:52:28 2004
New Revision: 57153

Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
Log:
- guard against ArrayIndexOutOfBounds

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java	Wed Nov 10
04:52:28 2004
@@ -227,12 +227,14 @@
                 propState.setValues(genValues);
             } else if (def.getDefaultValues() != null) {
                 Value[] vals = def.getDefaultValues();
-                int length = (def.isMultiple() ? vals.length : 1);
-                InternalValue[] defVals = new InternalValue[length];
-                for (int i = 0; i < length; i++) {
-                    defVals[i] = InternalValue.create(vals[i], session.getNamespaceResolver());
+                if (vals.length>0) {
+                    int length = (def.isMultiple() ? vals.length : 1);
+                    InternalValue[] defVals = new InternalValue[length];
+                    for (int i = 0; i < length; i++) {
+                        defVals[i] = InternalValue.create(vals[i], session.getNamespaceResolver());
+                    }
+                    propState.setValues(defVals);
                 }
-                propState.setValues(defVals);
             }
         } catch (ItemStateException ise) {
             String msg = "failed to add property " + name + " to " + safeGetJCRPath();

Mime
View raw message