jackrabbit-commits mailing list archives

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

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

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/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=631547&r1=631546&r2=631547&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 02:47:14 2008
@@ -210,13 +210,18 @@
      * {@inheritDoc}
      */
     public Object clone() {
-        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;
+        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");
+        }
     }
 
     /**

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=631547&r1=631546&r2=631547&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 02:47:14 2008
@@ -1150,19 +1150,24 @@
     }
 
     protected Object clone() {
-        EffectiveNodeType clone = new EffectiveNodeType();
+        try {
+            EffectiveNodeType clone = (EffectiveNodeType) super.clone();
 
-        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);
+            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;
+            return clone;
+        } catch (CloneNotSupportedException e) {
+            // won't happen
+            throw new InternalError("Failed to clone EffectiveNodeType object");
+        }
     }
 }

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=631547&r1=631546&r2=631547&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 02:47:14 2008
@@ -308,16 +308,21 @@
 
     //-------------------------------------------< java.lang.Object overrides >
     public Object clone() {
-        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;
+        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");
+        }
     }
 
     public boolean equals(Object obj) {



Mime
View raw message