jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r497809 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Date Fri, 19 Jan 2007 13:34:33 GMT
Author: stefan
Date: Fri Jan 19 05:34:32 2007
New Revision: 497809

URL: http://svn.apache.org/viewvc?view=rev&rev=497809
Log:
JCR-713: ConcurrentModificationException during registration of nodetypes

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?view=diff&rev=497809&r1=497808&r2=497809
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Fri Jan 19 05:34:32 2007
@@ -905,7 +905,6 @@
         eventChannel.setListener(this);
     }
 
-
     /**
      * @param ntName
      * @param entCache
@@ -1741,12 +1740,8 @@
     private void notifyRegistered(QName ntName) {
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la =
-                new NodeTypeRegistryListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
-        int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (NodeTypeRegistryListener) iter.next();
-        }
+                (NodeTypeRegistryListener[]) listeners.values().toArray(
+                        new NodeTypeRegistryListener[listeners.size()]); 
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
                 la[i].nodeTypeRegistered(ntName);
@@ -1760,12 +1755,8 @@
     private void notifyReRegistered(QName ntName) {
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la =
-                new NodeTypeRegistryListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
-        int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (NodeTypeRegistryListener) iter.next();
-        }
+                (NodeTypeRegistryListener[]) listeners.values().toArray(
+                        new NodeTypeRegistryListener[listeners.size()]);
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
                 la[i].nodeTypeReRegistered(ntName);
@@ -1779,12 +1770,8 @@
     private void notifyUnregistered(QName ntName) {
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la =
-                new NodeTypeRegistryListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
-        int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (NodeTypeRegistryListener) iter.next();
-        }
+                (NodeTypeRegistryListener[]) listeners.values().toArray(
+                        new NodeTypeRegistryListener[listeners.size()]);
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
                 la[i].nodeTypeUnregistered(ntName);



Mime
View raw message