jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1462232 - in /jackrabbit/oak/trunk/oak-jcr/src: main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java test/java/org/apache/jackrabbit/oak/jcr/tck/ApiIT.java
Date Thu, 28 Mar 2013 17:42:02 GMT
Author: mduerig
Date: Thu Mar 28 17:42:01 2013
New Revision: 1462232

URL: http://svn.apache.org/r1462232
Log:
OAK-662: Reduce boilerplate code in JCR impl methods
 Use ValueHelper.getType() instead of our own method

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/ApiIT.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1462232&r1=1462231&r2=1462232&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Thu Mar 28 17:42:01 2013
@@ -338,7 +338,7 @@ public class NodeImpl<T extends NodeDele
     public Property setProperty(String name, Value[] values)
             throws RepositoryException {
         if (values != null) {
-            return internalSetProperty(name, values, PropertyImpl.getType(values), false);
+            return internalSetProperty(name, values, ValueHelper.getType(values), false);
         } else {
             return internalRemoveProperty(name);
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1462232&r1=1462231&r2=1462232&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Thu Mar 28 17:42:01 2013
@@ -135,7 +135,7 @@ public class PropertyImpl extends ItemIm
         if (values == null) {
             internalRemove();
         } else {
-            internalSetValues(values, getType(values));
+            internalSetValues(values, ValueHelper.getType(values));
         }
     }
 
@@ -428,30 +428,6 @@ public class PropertyImpl extends ItemIm
     }
 
     /**
-     * Determine the {@link javax.jcr.PropertyType} of the passed values if all are of
-     * the same type.
-     *
-     * @param values array of values of the same type
-     * @return  {@link javax.jcr.PropertyType#UNDEFINED} if {@code values} is empty,
-     *          {@code values[0].getType()} otherwise.
-     * @throws javax.jcr.ValueFormatException  if not all {@code values} are of the same
type
-     */
-    static int getType(Value[] values) throws ValueFormatException {
-        int type = UNDEFINED;
-        for (Value value : values) {
-            if (value != null) {
-                if (type == UNDEFINED) {
-                    type = value.getType();
-                } else if (value.getType() != type) {
-                    throw new ValueFormatException(
-                            "All values of a multi-valued property must be of the same type");
-                }
-            }
-        }
-        return type;
-    }
-
-    /**
      * Return the length of the specified JCR value object.
      *
      * @param value The value.

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/ApiIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/ApiIT.java?rev=1462232&r1=1462231&r2=1462232&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/ApiIT.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/ApiIT.java
Thu Mar 28 17:42:01 2013
@@ -18,6 +18,8 @@ package org.apache.jackrabbit.oak.jcr.tc
 
 import junit.framework.Test;
 
+
+
 public class ApiIT extends TCKBase {
 
     public static Test suite() {



Mime
View raw message