jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r497826 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ItemImpl.java SessionImpl.java
Date Fri, 19 Jan 2007 14:26:24 GMT
Author: stefan
Date: Fri Jan 19 06:26:23 2007
New Revision: 497826

URL: http://svn.apache.org/viewvc?view=rev&rev=497826
Log:
cleaning up legacy code:
workaround for ReferenceMap.values().toArray() bug (http://issues.apache.org/bugzilla/show_bug.cgi?id=25551)
no longer necessary

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?view=diff&rev=497826&r1=497825&r2=497826
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
Fri Jan 19 06:26:23 2007
@@ -216,12 +216,9 @@
      */
     private void notifyCreated() {
         // copy listeners to array to avoid ConcurrentModificationException
-        ItemLifeCycleListener[] la = new ItemLifeCycleListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
-        int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (ItemLifeCycleListener) iter.next();
-        }
+        ItemLifeCycleListener[] la =
+                (ItemLifeCycleListener[]) listeners.values().toArray(
+                        new ItemLifeCycleListener[listeners.size()]);
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
                 la[i].itemCreated(this);
@@ -235,12 +232,9 @@
      */
     protected void notifyInvalidated() {
         // copy listeners to array to avoid ConcurrentModificationException
-        ItemLifeCycleListener[] la = new ItemLifeCycleListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
-        int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (ItemLifeCycleListener) iter.next();
-        }
+        ItemLifeCycleListener[] la =
+                (ItemLifeCycleListener[]) listeners.values().toArray(
+                        new ItemLifeCycleListener[listeners.size()]);
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
                 la[i].itemInvalidated(id, this);
@@ -254,12 +248,9 @@
      */
     protected void notifyDestroyed() {
         // copy listeners to array to avoid ConcurrentModificationException
-        ItemLifeCycleListener[] la = new ItemLifeCycleListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
-        int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (ItemLifeCycleListener) iter.next();
-        }
+        ItemLifeCycleListener[] la =
+                (ItemLifeCycleListener[]) listeners.values().toArray(
+                        new ItemLifeCycleListener[listeners.size()]);
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
                 la[i].itemDestroyed(id, this);
@@ -1080,7 +1071,7 @@
             Collection removed = getRemovedStates();
 
             /**
-             * build set of item id's who are within the scope of
+             * build set of item id's which are within the scope of
              * (i.e. affected by) this save operation
              */
             Set affectedIds = new HashSet(dirty.size() + removed.size());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?view=diff&rev=497826&r1=497825&r2=497826
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
Fri Jan 19 06:26:23 2007
@@ -528,12 +528,9 @@
      */
     protected void notifyLoggingOut() {
         // copy listeners to array to avoid ConcurrentModificationException
-        SessionListener[] la = new SessionListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
-        int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (SessionListener) iter.next();
-        }
+        SessionListener[] la =
+                (SessionListener[]) listeners.values().toArray(
+                        new SessionListener[listeners.size()]);
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
                 la[i].loggingOut(this);
@@ -546,12 +543,9 @@
      */
     protected void notifyLoggedOut() {
         // copy listeners to array to avoid ConcurrentModificationException
-        SessionListener[] la = new SessionListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
-        int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (SessionListener) iter.next();
-        }
+        SessionListener[] la =
+                (SessionListener[]) listeners.values().toArray(
+                        new SessionListener[listeners.size()]);
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
                 la[i].loggedOut(this);



Mime
View raw message