Author: pete.muir(a)jboss.org
Date: 2008-10-10 14:36:19 -0400 (Fri, 10 Oct 2008)
New Revision: 9255
Modified:
trunk/src/main/org/jboss/seam/Component.java
trunk/src/main/org/jboss/seam/core/Events.java
Log:
JBSEAM-3506
Modified: trunk/src/main/org/jboss/seam/Component.java
===================================================================
--- trunk/src/main/org/jboss/seam/Component.java 2008-10-10 18:14:55 UTC (rev 9254)
+++ trunk/src/main/org/jboss/seam/Component.java 2008-10-10 18:36:19 UTC (rev 9255)
@@ -1901,8 +1901,13 @@
public static Object getInstance(String name, boolean create)
{
+ return getInstance(name, create, true);
+ }
+
+ public static Object getInstance(String name, boolean create, boolean
allowAutocreation)
+ {
Object result = Contexts.lookupInStatefulContexts(name);
- result = getInstance(name, create, result);
+ result = getInstance(name, create, allowAutocreation, result);
return result;
}
@@ -1913,15 +1918,20 @@
public static Object getInstance(String name, ScopeType scope, boolean create)
{
+ return getInstance(name, scope, create, true);
+ }
+
+ public static Object getInstance(String name, ScopeType scope, boolean create, boolean
allowAutocreation)
+ {
Object result = scope==STATELESS ? null : scope.getContext().get(name);
- result = getInstance(name, create, result);
+ result = getInstance(name, create, allowAutocreation, result);
return result;
}
- private static Object getInstance(String name, boolean create, Object result) {
+ private static Object getInstance(String name, boolean create, boolean
allowAutoCreation, Object result) {
Component component = Component.forName(name);
- create = create || Init.instance().isAutocreateVariable(name);
+ create = create || (Init.instance().isAutocreateVariable(name) &&
allowAutoCreation);
if (result==null && create)
{
Modified: trunk/src/main/org/jboss/seam/core/Events.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/Events.java 2008-10-10 18:14:55 UTC (rev 9254)
+++ trunk/src/main/org/jboss/seam/core/Events.java 2008-10-10 18:36:19 UTC (rev 9255)
@@ -74,7 +74,7 @@
for (ObserverMethod observer: observers)
{
String name = observer.getComponent().getName();
- Object listener = Component.getInstance( name, observer.isCreate() );
+ Object listener = Component.getInstance( name, observer.isCreate(), false );
if ( observer.getComponent().hasUnwrapMethod() )
{
listener = observer.getComponent().getScope().getContext().get(name);
Show replies by date