[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...
Gavin King
gavin.king at jboss.com
Fri Nov 24 17:09:21 EST 2006
User: gavin
Date: 06/11/24 17:09:21
Modified: src/main/org/jboss/seam Component.java
Log:
fix a bug where seam tried to instantiate components in non-active context
Revision Changes Path
1.212 +16 -9 jboss-seam/src/main/org/jboss/seam/Component.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Component.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -b -r1.211 -r1.212
--- Component.java 17 Nov 2006 02:35:45 -0000 1.211
+++ Component.java 24 Nov 2006 22:09:21 -0000 1.212
@@ -120,7 +120,7 @@
*
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @author Gavin King
- * @version $Revision: 1.211 $
+ * @version $Revision: 1.212 $
*/
@Scope(ScopeType.APPLICATION)
@SuppressWarnings("deprecation")
@@ -1595,7 +1595,7 @@
//needed when this method is called by JSF
if ( log.isDebugEnabled() ) log.debug("seam component not found: " + name);
}
- else
+ else if ( component.getScope().isContextActive() )
{
result = component.newInstance();
}
@@ -1631,21 +1631,28 @@
Init.FactoryMethod factoryMethod = init.getFactory(name);
Init.FactoryBinding methodBinding = init.getFactoryMethodBinding(name);
Init.FactoryBinding valueBinding = init.getFactoryValueBinding(name);
- if (methodBinding!=null) //let the XML take precedence
+ if ( methodBinding!=null && methodBinding.getScope().isContextActive() ) //let the XML take precedence
{
Object result = methodBinding.getMethodBinding().invoke();
- return handleFactoryMethodResult(name, null, result, methodBinding.getScope());
+ return handleFactoryMethodResult( name, null, result, methodBinding.getScope() );
}
- else if (valueBinding!=null) //let the XML take precedence
+ else if ( valueBinding!=null && valueBinding.getScope().isContextActive() ) //let the XML take precedence
{
Object result = valueBinding.getValueBinding().getValue();
- return handleFactoryMethodResult(name, null, result, valueBinding.getScope());
+ return handleFactoryMethodResult( name, null, result, valueBinding.getScope() );
}
- else if (factoryMethod!=null)
+ else if ( factoryMethod!=null && factoryMethod.getScope().isContextActive() )
{
Object factory = Component.getInstance( factoryMethod.getComponent().getName(), true );
- Object result = factoryMethod.getComponent().callComponentMethod(factory, factoryMethod.getMethod());
- return handleFactoryMethodResult(name, factoryMethod.getComponent(), result, factoryMethod.getScope());
+ if (factory==null)
+ {
+ return null;
+ }
+ else
+ {
+ Object result = factoryMethod.getComponent().callComponentMethod( factory, factoryMethod.getMethod() );
+ return handleFactoryMethodResult( name, factoryMethod.getComponent(), result, factoryMethod.getScope() );
+ }
}
else
{
More information about the jboss-cvs-commits
mailing list