Author: felixk
Date: Fri Sep 30 10:35:17 2011
New Revision: 1177582

URL: http://svn.apache.org/viewvc?rev=1177582&view=rev
Log:
Avoid NPE. synchronized(null) throws NPE, so a check if null is obsolete.

Modified:
    
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/AbstractDelegatingMailboxListener.java

Modified: 
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/AbstractDelegatingMailboxListener.java
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/AbstractDelegatingMailboxListener.java?rev=1177582&r1=1177581&r2=1177582&view=diff
==============================================================================
--- 
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/AbstractDelegatingMailboxListener.java
 (original)
+++ 
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/AbstractDelegatingMailboxListener.java
 Fri Sep 30 10:35:17 2011
@@ -71,20 +71,22 @@ public abstract class AbstractDelegating
         
         
         List<MailboxListener> globalListeners = getGlobalListeners();
-        synchronized (globalListeners) {
-            if (globalListeners != null && globalListeners.isEmpty() == false) 
{
-                List<MailboxListener> closedListener = new 
ArrayList<MailboxListener>();
-                
-                int sz = globalListeners.size();
-                for (int i = 0; i < sz; i++) {
-                    MailboxListener l = globalListeners.get(i);
-                    l.event(event);
+        if (globalListeners != null) {
+            synchronized (globalListeners) {
+                if (globalListeners.isEmpty() == false) {
+                    List<MailboxListener> closedListener = new 
ArrayList<MailboxListener>();
                     
-                }
-                
-              
-                if (closedListener.isEmpty() == false) {
-                    globalListeners.removeAll(closedListener);
+                    int sz = globalListeners.size();
+                    for (int i = 0; i < sz; i++) {
+                        MailboxListener l = globalListeners.get(i);
+                        l.event(event);
+                        
+                    }
+                    
+                  
+                    if (closedListener.isEmpty() == false) {
+                        globalListeners.removeAll(closedListener);
+                    }
                 }
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to