jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r631626 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype: BitsetENTCacheImpl.java EffectiveNodeType.java EffectiveNodeTypeCacheImpl.java NodeTypeDef.java
Date Wed, 27 Feb 2008 16:10:20 GMT
Author: stefan
Date: Wed Feb 27 08:10:06 2008
New Revision: 631626

URL: http://svn.apache.org/viewvc?rev=631626&view=rev
Log:
JCR-1423:  [PATCH] fix clone implementation

undoing r631547 & r631560 due to failing test cases...

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/BitsetENTCacheImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/BitsetENTCacheImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/BitsetENTCacheImpl.java?rev=631626&r1=631625&r2=631626&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/BitsetENTCacheImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/BitsetENTCacheImpl.java
Wed Feb 27 08:10:06 2008
@@ -210,18 +210,13 @@
      * {@inheritDoc}
      */
     public Object clone() {
-        try {
-            BitsetENTCacheImpl clone = (BitsetENTCacheImpl) super.clone();
-            clone.sortedKeys.addAll(sortedKeys);
-            clone.aggregates.putAll(aggregates);
-            clone.names = new Name[names.length];
-            System.arraycopy(names, 0, clone.names, 0, names.length);
-            clone.nameIndex.putAll(nameIndex);
-            return clone;
-        } catch (CloneNotSupportedException e) {
-            // won't happen
-            throw new InternalError("Failed to clone BitsetENTCacheImpl");
-        }
+        BitsetENTCacheImpl clone = new BitsetENTCacheImpl();
+        clone.sortedKeys.addAll(sortedKeys);
+        clone.aggregates.putAll(aggregates);
+        clone.names = new Name[names.length];
+        System.arraycopy(names, 0, clone.names, 0, names.length);
+        clone.nameIndex.putAll(nameIndex);
+        return clone;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java?rev=631626&r1=631625&r2=631626&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
Wed Feb 27 08:10:06 2008
@@ -1150,24 +1150,19 @@
     }
 
     protected Object clone() {
-        try {
-            EffectiveNodeType clone = (EffectiveNodeType) super.clone();
+        EffectiveNodeType clone = new EffectiveNodeType();
 
-            clone.mergedNodeTypes.addAll(mergedNodeTypes);
-            clone.inheritedNodeTypes.addAll(inheritedNodeTypes);
-            clone.allNodeTypes.addAll(allNodeTypes);
-            Iterator iter = namedItemDefs.keySet().iterator();
-            while (iter.hasNext()) {
-                Object key = iter.next();
-                List list = (List) namedItemDefs.get(key);
-                clone.namedItemDefs.put(key, new ArrayList(list));
-            }
-            clone.unnamedItemDefs.addAll(unnamedItemDefs);
-
-            return clone;
-        } catch (CloneNotSupportedException e) {
-            // won't happen
-            throw new InternalError("Failed to clone EffectiveNodeType object");
+        clone.mergedNodeTypes.addAll(mergedNodeTypes);
+        clone.inheritedNodeTypes.addAll(inheritedNodeTypes);
+        clone.allNodeTypes.addAll(allNodeTypes);
+        Iterator iter = namedItemDefs.keySet().iterator();
+        while (iter.hasNext()) {
+            Object key = iter.next();
+            List list = (List) namedItemDefs.get(key);
+            clone.namedItemDefs.put(key, new ArrayList(list));
         }
+        clone.unnamedItemDefs.addAll(unnamedItemDefs);
+
+        return clone;
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java?rev=631626&r1=631625&r2=631626&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java
Wed Feb 27 08:10:06 2008
@@ -163,15 +163,10 @@
      * {@inheritDoc}
      */
     public Object clone() {
-        try {
-            EffectiveNodeTypeCacheImpl clone = (EffectiveNodeTypeCacheImpl) super.clone();
-            clone.sortedKeys.addAll(sortedKeys);
-            clone.aggregates.putAll(aggregates);
-            return clone;
-        } catch (CloneNotSupportedException e) {
-            // won't happen
-            throw new InternalError("Failed to clone EffectiveNodeTypeCacheImpl object");
-        }
+        EffectiveNodeTypeCacheImpl clone = new EffectiveNodeTypeCacheImpl();
+        clone.sortedKeys.addAll(sortedKeys);
+        clone.aggregates.putAll(aggregates);
+        return clone;
     }
 
     //-------------------------------------------------------------< Dumpable >

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java?rev=631626&r1=631625&r2=631626&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
Wed Feb 27 08:10:06 2008
@@ -308,21 +308,16 @@
 
     //-------------------------------------------< java.lang.Object overrides >
     public Object clone() {
-        try {
-            NodeTypeDef clone = (NodeTypeDef) super.clone();
-            clone.name = name;
-            clone.primaryItemName = primaryItemName;
-            clone.supertypes = supertypes; // immutable, thus ok to share
-            clone.mixin = mixin;
-            clone.orderableChildNodes = orderableChildNodes;
-            clone.abstractStatus = abstractStatus;
-            clone.nodeDefs = (HashSet) nodeDefs.clone();
-            clone.propDefs = (HashSet) propDefs.clone();
-            return clone;
-        } catch (CloneNotSupportedException e) {
-            // won't happen
-            throw new InternalError("Failed to clone NodeTypeDef object");
-        }
+        NodeTypeDef clone = new NodeTypeDef();
+        clone.name = name;
+        clone.primaryItemName = primaryItemName;
+        clone.supertypes = supertypes; // immutable, thus ok to share
+        clone.mixin = mixin;
+        clone.orderableChildNodes = orderableChildNodes;
+        clone.abstractStatus = abstractStatus;
+        clone.nodeDefs = (HashSet) nodeDefs.clone();
+        clone.propDefs = (HashSet) propDefs.clone();
+        return clone;
     }
 
     public boolean equals(Object obj) {



Mime
View raw message