jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: rev 54784 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: . version
Date Thu, 14 Oct 2004 13:41:53 GMT
Author: tripod
Date: Thu Oct 14 06:41:53 2004
New Revision: 54784

Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
Log:
- Checkin did not work if node has unreferenceable child node with OPV=Copy

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	Thu Oct 14
06:41:53 2004
@@ -2666,11 +2666,11 @@
     void restoreFrozenState(InternalFrozenNode freeze, VersionSelector vsel)
             throws RepositoryException {
         // check uuid
-        if (!isNodeType(NodeTypeRegistry.MIX_REFERENCEABLE)) {
-            throw new ItemExistsException("Unable to restore version of " + safeGetJCRPath()
+ ". Not referenceable.");
-        }
-        if (!freeze.getFrozenUUID().equals(getUUID())) {
-            throw new ItemExistsException("Unable to restore version of " + safeGetJCRPath()
+ ". UUID changed.");
+        if (isNodeType(NodeTypeRegistry.MIX_REFERENCEABLE)) {
+            String uuid = freeze.getFrozenUUID();
+            if (uuid!=null && !uuid.equals(getUUID())) {
+                throw new ItemExistsException("Unable to restore version of " + safeGetJCRPath()
+ ". UUID changed.");
+            }
         }
         // check primarty type
         if (!freeze.getFrozenPrimaryType().equals(nodeType.getQName())) {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalFrozenNode.java
Thu Oct 14 06:41:53 2004
@@ -55,17 +55,17 @@
     /**
      * the frozen uuid of the original node
      */
-    private String frozenUUID;
+    private String frozenUUID=null;
 
     /**
      * the frozen primary type of the orginal node
      */
-    private QName frozenPrimaryType;
+    private QName frozenPrimaryType=null;
 
     /**
      * the frozen list of mixin types of the original node
      */
-    private QName[] frozenMixinTypes;
+    private QName[] frozenMixinTypes=null;
 
     /**
      * Creates a new frozen node based on the given persistance node.
@@ -76,29 +76,28 @@
     protected InternalFrozenNode(PersistentNode node) throws RepositoryException {
         this.node = node;
 
-        // init the internal properties
-        frozenUUID = node.getPropertyValue(VersionManager.PROPNAME_FROZEN_UUID).internalValue().toString();
-        frozenPrimaryType = (QName) node.getPropertyValue(VersionManager.PROPNAME_FROZEN_PRIMARY_TYPE).internalValue();
-        InternalValue[] values = node.getPropertyValues(VersionManager.PROPNAME_FROZEN_MIXIN_TYPES);
-        if (values == null) {
-            frozenMixinTypes = new QName[0];
-        } else {
-            frozenMixinTypes = new QName[values.length];
-            for (int i = 0; i < values.length; i++) {
-                frozenMixinTypes[i] = (QName) values[i].internalValue();
-            }
-        }
         // init the frozen properties
         PersistentProperty[] props = node.getProperties();
         List propList = new ArrayList();
         for (int i = 0; i < props.length; i++) {
             PersistentProperty prop = props[i];
             if (prop.getName().equals(VersionManager.PROPNAME_FROZEN_UUID)) {
-                // already set
+                // special property
+                frozenUUID = node.getPropertyValue(VersionManager.PROPNAME_FROZEN_UUID).internalValue().toString();
             } else if (prop.getName().equals(VersionManager.PROPNAME_FROZEN_PRIMARY_TYPE))
{
-                // already set
+                // special property
+                frozenPrimaryType = (QName) node.getPropertyValue(VersionManager.PROPNAME_FROZEN_PRIMARY_TYPE).internalValue();
             } else if (prop.getName().equals(VersionManager.PROPNAME_FROZEN_MIXIN_TYPES))
{
-                // already set
+                // special property
+                InternalValue[] values = node.getPropertyValues(VersionManager.PROPNAME_FROZEN_MIXIN_TYPES);
+                if (values == null) {
+                    frozenMixinTypes = new QName[0];
+                } else {
+                    frozenMixinTypes = new QName[values.length];
+                    for (int j = 0; j < values.length; j++) {
+                        frozenMixinTypes[j] = (QName) values[j].internalValue();
+                    }
+                }
             } else if (prop.getName().equals(ItemImpl.PROPNAME_PRIMARYTYPE)) {
                 // ignore
             } else if (prop.getName().equals(ItemImpl.PROPNAME_UUID)) {
@@ -109,6 +108,13 @@
         }
         frozenProperties = (PersistentProperty[]) propList.toArray(new PersistentProperty[propList.size()]);
 
+        // do some checks
+        if (frozenMixinTypes==null) {
+            frozenMixinTypes=new QName[0];
+        }
+        if (frozenPrimaryType==null) {
+            throw new RepositoryException("Illegal frozen node. Must have 'frozenPrimaryType'");
+        }
         // init the frozen child nodes
         PersistentNode[] childNodes = node.getChildNodes();
         frozenChildNodes = new InternalFreeze[childNodes.length];

Mime
View raw message