Hi Mark;

Is it still valid ? 

/Gurkan




________________________________
From: "[email protected]" <[email protected]>
To: [email protected]
Sent: Thursday, February 26, 2009 6:29:38 PM
Subject: svn commit: r748198 - 
/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java

Author: struberg
Date: Thu Feb 26 16:29:37 2009
New Revision: 748198

URL: http://svn.apache.org/viewvc?rev=748198&view=rev
Log:
OWB-82 throw IllegalArbumentException if 2 active scopes are being registered

Modified:
    
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java

Modified: 
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java?rev=748198&r1=748197&r2=748198&view=diff
==============================================================================
--- 
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
 (original)
+++ 
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
 Thu Feb 26 16:29:37 2009
@@ -118,15 +118,15 @@

         List<Context> contexts = new ArrayList<Context>();
        
-        Context standartContext = null;
+        Context standardContext = null;

-        standartContext = ContextFactory.getStandardContext(scopType);
+        standardContext = ContextFactory.getStandardContext(scopType);

-        if(standartContext != null)
+        if(standardContext != null)
         {
-            if(standartContext.isActive())
+            if(standardContext.isActive())
             {
-                contexts.add(standartContext);  
+                contexts.add(standardContext);  
             }
         }
        
@@ -422,6 +422,10 @@
         }
         else
         {
+            if (context.isActive() && containsActiveContext(contextList))
+            {
+                throw new IllegalArgumentException("There is already an active 
Context registered for this scope! Context=" + context);
+            }
             contextList.add(context);
         }

@@ -445,4 +449,20 @@
         return this;
     }

+    /**
+     * Check if the given contextList contains an active Context
+     * @param contextList
+     * @return <code>true</code> if the given contextList contains an active 
Context, <code>false</code> otherwise
+     */
+    private boolean containsActiveContext(List<Context> contextList)
+    {
+        for (Context c : contextList)
+        {
+            if (c.isActive())
+            {
+                return true;
+            }
+        }
+        return false;
+    }
}
\ No newline at end of file


      

Reply via email to