jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r921779 - in /jackrabbit/trunk: jackrabbit-jcr2dav/pom.xml jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
Date Thu, 11 Mar 2010 10:25:34 GMT
Author: angela
Date: Thu Mar 11 10:25:33 2010
New Revision: 921779

URL: http://svn.apache.org/viewvc?rev=921779&view=rev
Log:
JCR-2547: Setting a property which has been transiently removed fails with a PathNotFoundException

Modified:
    jackrabbit/trunk/jackrabbit-jcr2dav/pom.xml
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2dav/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2dav/pom.xml?rev=921779&r1=921778&r2=921779&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2dav/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-jcr2dav/pom.xml Thu Mar 11 10:25:33 2010
@@ -115,17 +115,12 @@
                       org.apache.jackrabbit.jcr2spi.IsSameTest#testIsSameProperty4
                       org.apache.jackrabbit.jcr2spi.IsSameTest#testIsSameNode7
                       
-                      <!-- known issue!? -->                        
+                      <!-- Known, general issue of the Jcr2Spi - SPI setup.
+                           No notification about changes to registered namespace(s) -->
                       
                       org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryTest#testReRegisteredNamespace
                       org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryTest#testReRegisteredNamespaceVisibility
                       
-                      <!-- JCR-2547: Setting a property which has been transiently removed
fails with a PathNotFoundException -->
-                      org.apache.jackrabbit.jcr2spi.AddPropertyTest#testReplacingProperty
-                      org.apache.jackrabbit.jcr2spi.AddPropertyTest#testReplacingProperty2
-                      org.apache.jackrabbit.jcr2spi.AddPropertyTest#testAddingProperty
-                      org.apache.jackrabbit.jcr2spi.AddPropertyTest#testAddingProperty2
-                      
-                      <!-- JCR-2548: Node#unlock sometimes fails with LockException: Precondition
Failed -->                    
+                      <!-- JCR-2548: Node#unlock sometimes fails with LockException: Precondition
Failed -->
                       org.apache.jackrabbit.jcr2spi.lock.OpenScopedLockTest#testLogoutHasNoEffect
                   </value>
                 </property>

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java?rev=921779&r1=921778&r2=921779&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
Thu Mar 11 10:25:33 2010
@@ -538,7 +538,7 @@ public class RepositoryServiceImpl exten
         public void addProperty(NodeId parentId, Name propertyName, QValue value) throws
RepositoryException {
             assertMethod();
             Path p = getPathFactory().create(getPath(parentId, sessionInfo), propertyName,
true);
-            setProperty(p, value);
+            setProperty(p, value, false);
         }
 
         /**
@@ -547,7 +547,7 @@ public class RepositoryServiceImpl exten
         public void addProperty(NodeId parentId, Name propertyName, QValue[] values) throws
RepositoryException {
             assertMethod();
             Path p = getPathFactory().create(getPath(parentId, sessionInfo), propertyName,
true);
-            setProperty(p, values);
+            setProperty(p, values, false);
         }
 
         /**
@@ -555,7 +555,8 @@ public class RepositoryServiceImpl exten
          */
         public void setValue(PropertyId propertyId, QValue value) throws RepositoryException
{
             assertMethod();
-            setProperty(getPath(propertyId, sessionInfo), value);
+            Path p = getPath(propertyId, sessionInfo);
+            setProperty(p, value, false);
         }
 
         /**
@@ -564,7 +565,7 @@ public class RepositoryServiceImpl exten
         public void setValue(PropertyId propertyId, QValue[] values) throws RepositoryException
{
             assertMethod();
             Path p = getPath(propertyId, sessionInfo);
-            setProperty(p, values);
+            setProperty(p, values, false);
         }
 
         /**
@@ -580,6 +581,7 @@ public class RepositoryServiceImpl exten
             String rmJcrPath = getNamePathResolver(sessionInfo).getJCRPath(rmPath);
             appendDiff(SYMBOL_REMOVE, rmJcrPath, null);
 
+            // clear the uri-lookup in case the itemID contains a uniqueID part.
             if (itemId.getPath() == null) {
                 clear = true;
             }
@@ -616,7 +618,10 @@ public class RepositoryServiceImpl exten
             for (int i = 0; i < mixinNodeTypeNames.length; i++) {
                 vs[i] = getQValueFactory(sessionInfo).create(mixinNodeTypeNames[i]);
             }
-            addProperty(nodeId, NameConstants.JCR_MIXINTYPES, vs);
+            Path p = getPathFactory().create(getPath(nodeId, sessionInfo), NameConstants.JCR_MIXINTYPES,
true);
+            // register the diff entry including clearing previous calls to
+            // setMixins for the same node.
+            setProperty(p, vs, true);
         }
 
         /**
@@ -626,7 +631,10 @@ public class RepositoryServiceImpl exten
             assertMethod();
 
             QValue v = getQValueFactory(sessionInfo).create(primaryNodeTypeName);
-            addProperty(nodeId, NameConstants.JCR_PRIMARYTYPE, v);
+            Path p = getPathFactory().create(getPath(nodeId, sessionInfo), NameConstants.JCR_PRIMARYTYPE,
true);
+            // register the diff entry including clearing previous calls to
+            // setPrimaryType for the same node.
+            setProperty(p, v, true);
         }
 
         /**
@@ -665,10 +673,12 @@ public class RepositoryServiceImpl exten
          * @param value
          * @throws RepositoryException
          */
-        private void setProperty(Path propPath, QValue value) throws RepositoryException
{
+        private void setProperty(Path propPath, QValue value, boolean clearPrevious) throws
RepositoryException {
             NamePathResolver resolver = getNamePathResolver(sessionInfo);
             String jcrPropPath = resolver.getJCRPath(propPath);
-            clearPreviousSetProperty(jcrPropPath);
+            if (clearPrevious) {
+                clearPreviousSetProperty(jcrPropPath);
+            }
 
             String strValue = getJsonString(value);
             appendDiff(SYMBOL_SET_PROPERTY, jcrPropPath, strValue);
@@ -677,10 +687,12 @@ public class RepositoryServiceImpl exten
             }
         }
 
-        private void setProperty(Path propPath, QValue[] values) throws RepositoryException
{
+        private void setProperty(Path propPath, QValue[] values, boolean clearPrevious) throws
RepositoryException {
             NamePathResolver resolver = getNamePathResolver(sessionInfo);
             String jcrPropPath = resolver.getJCRPath(propPath);
-            clearPreviousSetProperty(jcrPropPath);
+            if (clearPrevious) {
+                clearPreviousSetProperty(jcrPropPath);
+            }
 
             StringBuffer strVal = new StringBuffer("[");
             for (int i = 0; i < values.length; i++) {



Mime
View raw message