jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1397528 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/value/ValueImpl.java
Date Fri, 12 Oct 2012 11:59:04 GMT
Author: mduerig
Date: Fri Oct 12 11:59:04 2012
New Revision: 1397528

URL: http://svn.apache.org/viewvc?rev=1397528&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
check arguments

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/value/ValueImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/value/ValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/value/ValueImpl.java?rev=1397528&r1=1397527&r2=1397528&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/value/ValueImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/value/ValueImpl.java
Fri Oct 12 11:59:04 2012
@@ -39,6 +39,8 @@ import org.apache.jackrabbit.util.ISO860
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 /**
  * ValueImpl...
  */
@@ -52,13 +54,19 @@ public class ValueImpl implements Value 
     private InputStream stream = null;
 
     ValueImpl(PropertyState propertyState, int index, NamePathMapper namePathMapper) {
+        checkArgument(index < propertyState.count());
         this.propertyState = propertyState;
         this.index = index;
         this.namePathMapper = namePathMapper;
     }
 
     ValueImpl(PropertyState property, NamePathMapper namePathMapper) {
-        this(property, 0, namePathMapper);
+        this(checkSingleValued(property), 0, namePathMapper);
+    }
+
+    private static PropertyState checkSingleValued(PropertyState property) {
+        checkArgument(!property.isArray());
+        return property;
     }
 
     //--------------------------------------------------------------< Value >---



Mime
View raw message