jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1485078 - in /jackrabbit/oak/trunk/oak-jcr/src: main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Date Wed, 22 May 2013 06:20:53 GMT
Author: jukka
Date: Wed May 22 06:20:53 2013
New Revision: 1485078

URL: http://svn.apache.org/r1485078
Log:
OAK-510: Multivalued properties with array size 0 forget their type

Fix handling of empty multivalued properties in oak-jcr

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java?rev=1485078&r1=1485077&r2=1485078&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
Wed May 22 06:20:53 2013
@@ -38,11 +38,13 @@ import javax.jcr.nodetype.PropertyDefini
 import javax.jcr.version.VersionManager;
 
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.jcr.delegate.ItemDelegate;
 import org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate;
 import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
 import org.apache.jackrabbit.oak.jcr.delegate.SessionOperation;
+import org.apache.jackrabbit.oak.plugins.memory.MemoryPropertyBuilder;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.plugins.nodetype.DefinitionProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.EffectiveNodeTypeProvider;
@@ -427,10 +429,13 @@ abstract class ItemImpl<T extends ItemDe
 
         Value[] nonNullValues = compact(values);
         int targetType = getType(definition, type);
-        if (targetType == type) {
+        if (nonNullValues.length == 0) {
+            return MemoryPropertyBuilder
+                    .array(Type.fromTag(type, false), name)
+                    .getPropertyState();
+        } else if (targetType == type) {
             return PropertyStates.createProperty(name, Arrays.asList(nonNullValues));
-        }
-        else {
+        } else {
             return PropertyStates.createProperty(name, Arrays.asList(ValueHelper.convert(
                     values, targetType, getValueFactory())));
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1485078&r1=1485077&r2=1485078&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Wed May 22 06:20:53 2013
@@ -786,7 +786,6 @@ public class RepositoryTest extends Abst
         }
     }
 
-    @Ignore("OAK-510") // FIXME: OAK-510
     @Test
     public void addEmptyMultiValueName() throws RepositoryException {
         Node parentNode = getNode(TEST_PATH);



Mime
View raw message