[JBoss JIRA] Created: (JBSEAM-368) STATELESS component injection rules are not intuitive/undocumented
by Christian Bauer (JIRA)
STATELESS component injection rules are not intuitive/undocumented
------------------------------------------------------------------
Key: JBSEAM-368
URL: http://jira.jboss.com/jira/browse/JBSEAM-368
Project: JBoss Seam
Issue Type: Bug
Reporter: Christian Bauer
Priority: Minor
This is probably a non-issue, so feel free to ignore.
It took me a while to figure out why this works:
@In(create=true)
MyStatelessComponent myComponent;
but this doesn't:
@In
MyStatelessComponent myComponent;
It was easy to figure out that it apparently is required, but from looking at the documentation this isn't clear. I also found it difficult to think about "creation of a component" when it is already there in the stateless EJB pool. I checked the code and there is some consistency in the internal logic, of course.
Users however might read the docs and say: "@In searches all contexts hierarchically, so it should find myComponent in STATELESS, because Seam logged that binding on startup."
Also, attempts to remove the create="true" with
@In(value = "myComponent", scope = ScopeType.STATELESS)
MyStatelessComponent myComponent;
resulted in JNDI lookup("myComponent"), which makes not much sense and returns null.
I suggest we add something to the documentation about lookup/injection of stateless components (I'm not sure if I'm 100% right about this, otherwise I would have added it).
Side note, I found the following additional debug logging lines in Component.java very helpful during development:
private Object getInstanceToInject(In in, String name, Object bean, boolean enforceRequired)
{
Object result;
if ( name.startsWith("#") )
{
log.debug("Searching for injection variable with value binding expression: " + name);
FacesContext facesCtx = FacesContext.getCurrentInstance();
Application application = facesCtx.getApplication();
result = application.createValueBinding(name).getValue(facesCtx);
}
else if (in.scope()==ScopeType.UNSPECIFIED)
{
log.debug("Searching hierarchically for injection variable in all scopes: " + name);
result = getInstance(name, in.create());
}
else
{
if ( in.create() )
{
throw new IllegalArgumentException(
"cannot combine create=true with explicit scope on @In: " +
getAttributeMessage(name)
);
}
log.debug("Searching for injection variable in scope: " + name + ", scope: " + in.scope());
result = in.scope().getContext().get(name);
}
if (result==null && enforceRequired && in.required())
{
throw new RequiredException(
"In attribute requires value for component: " +
getAttributeMessage(name)
);
}
else
{
return result;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 3 months
[JBoss JIRA] Created: (JBSEAM-335) NullPointerException if user quikcly decides to click a different link or button before the page renders
by Keith Naas (JIRA)
NullPointerException if user quikcly decides to click a different link or button before the page renders
--------------------------------------------------------------------------------------------------------
Key: JBSEAM-335
URL: http://jira.jboss.com/jira/browse/JBSEAM-335
Project: JBoss Seam
Issue Type: Bug
Environment: Seam 1.0.1.GA. JBoss 4.0.4, Windows XP, Facelets, MyFaces, Hibernate
Reporter: Keith Naas
When a user is on one of our screens, they can decide to click a link before the next page loads. Sometimes, when this do this quickly enough, it causes a NullPointerException in Manager.touchConversationStack at line 181. Somehow, the currentConversationEntry is null and it breaks when it executes getCurrentConversationEntry().touch().
I tried unsuccessfully to duplicate this scenario on the Hotel and DVD Store demos hosted on JBoss.
Stack Trace
java.lang.NullPointerException
at org.jboss.seam.core.Manager.touchConversationStack(Manager.java:181)
at org.jboss.seam.core.Manager.storeConversation(Manager.java:368)
at org.jboss.seam.jsf.AbstractSeamPhaseListener.storeAnyConversationContext(AbstractSeamPhaseListener.java:69)
at org.jboss.seam.jsf.SeamStateManager.saveSerializedView(SeamStateManager.java:45)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:578)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
.....
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 3 months