You mean, in both cases will we throw "IllegalStateException"? Or for third party contexts, will we throw "IllegalArgumentException"?
Thanks; /Gurkan ________________________________ From: Mark Struberg <[email protected]> To: [email protected] Sent: Friday, February 27, 2009 10:41:19 AM Subject: Re: svn commit: r748198 - /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java I had a discussion with Pete over at the jsr299 list about this yesterday: http://markmail.org/message/3ecfzddplb4shf4i Pete now will throw an IllegalStateException in both cases. Have to pull in the latest TCK today and change our behaviour. In praxis this will not do much for our _current_ standard contexts, because imho this cannot happen for them. But it may happen for 3rd party contexts, so we imho have to implement the check. WDYT? LieGrue, strub --- Gurkan Erdogdu <[email protected]> schrieb am Fr, 27.2.2009: > Von: Gurkan Erdogdu <[email protected]> > Betreff: Re: svn commit: r748198 - > /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java > An: [email protected] > Datum: Freitag, 27. Februar 2009, 7:48 > 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
