[jboss-jira] [JBoss JIRA] Created: (JBSEAM-318) ViewHandler.createView using SeamViewHandler.calculateLocale tries to use already released FacesContext when used outside lifecycle

Tuomas Kiviaho (JIRA) jira-events at jboss.com
Wed Jul 26 06:27:11 EDT 2006


ViewHandler.createView using SeamViewHandler.calculateLocale tries to use already released FacesContext when used outside lifecycle
-----------------------------------------------------------------------------------------------------------------------------------

                 Key: JBSEAM-318
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-318
             Project: JBoss Seam
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.0.1
         Environment: JBoss 4.0.4.GA
MyFaces 1.1.3
            Reporter: Tuomas Kiviaho


ViewHandler.createView can't be used outside lifecycle phases. The locale calculation done by seam view handler using locale selector ends up in a NullPointerException (should propably be t be IllegalStateException)
in MyFaces external context implementation if FacesContext had already been consumed by Seam threadlocals (Contexts) 

One could ask why I am using createView outside lifecycle, but this is what happens when done so.

StackTrace (NullPointerException):
ApplicationMap.getAttribute(String) line: 42	
ApplicationMap(AbstractAttributeMap).get(Object) line: 87	
FacesApplicationContext.get(String) line: 46	
FacesApplicationContext.get(Class) line: 79	
Init.instance() line: 95	
Component.getInstanceFromFactory(String) line: 1199	
Component.getInstance(String, boolean, Object) line: 1176	
Component.getInstance(String, ScopeType, boolean) line: 1169	
LocaleSelector.instance() line: 123	
SeamViewHandler.calculateLocale(FacesContext) line: 32	
JspViewHandlerImpl.createView(FacesContext, String) line: 130	

To tacle the symptom:
1. FacesContext.getExternalContext could be used inside Seam's FacesApplicationContext  instead of direct reference to see if the context has been released by catching the IllegalStateException that MyFaces throws. 
2. Using external context with RuntimeException precaution 
(3. Blame the messenger)

But what then can be done inside Seam goes beyond my knowledge, since Seam's component instantiation is a core part of the system. Of course this step can be left alone just by a try/catch around locale selector instantiation and continuing with a warning.

-- 
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

        



More information about the jboss-jira mailing list