You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Madhan Mohan <mo...@gmail.com> on 2011/06/06 11:27:29 UTC

org.apache.myfaces.el.VariableResolverImpl throws java.lang.IllegalStateException when it unsets the scope as null

Hi,

I am running an application in Geronimo 2.1.7 and that requires a valid
scope, but what we see is java.lang.IllegalStateException during application
startup

Servlet.service() for servlet jsp  threw exception
java.lang.IllegalStateException: unknown scope defined: null
       at
org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResol
verImpl.java:71)
       at
org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(Vari
ableResolverToELResolver.java:93)
       at
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
---------------
---------------
Servlet.service() for servlet jsp  threw exception
java.lang.NullPointerException
       at
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$3
01(FacesCompositeELResolver.java:46)
       at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$4.invoke
(FacesCompositeELResolver.java:108)
       at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(F
acesCompositeELResolver.java:148)
       at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue
(FacesCompositeELResolver.java:104)
       at
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)

I have created a small debug application and tested the scenario to find the
valid scopes.It looks to be the scopes are available for the application and
only thing is some how the scope value getting as null before a call made to
org.apache.myfaces.el.VariableResolverImpl.resolveVariable and it leads the
above exception.

11:25:26,650 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope  after
setScope() is JSP.
..
..
11:25:26,652 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope  after
setScope() is Faces.
....
11:25:26,652 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope  before
unsetScope() is Faces.
...

the following is the code snippet where it sets and unsets the scope values.
try
       {
           setScope(requestMap);
           super.setValue(context, base, property, val);
       }
       finally
       {
           unsetScope(requestMap);
       }

So to fix the above issue i made changes to the following code snippet in
the FacesCompositeELResolver to put back previous scope value for
application availability

try
       {
           prevScope = getScope(requestMap);
           setScope(requestMap);
           super.setValue(context, base, property, val);
       }
       finally
       {
           if( prevScope != null){
              setScope(requestMap, prevScope);
           }else{
              unsetScope(requestMap);
           }
       }

Can any one review the changes made to the following patch for the above
issue and provide your comments.

https://issues.apache.org/jira/browse/MYFACES-3166

Thanks
Mohan R Siripi

Re: org.apache.myfaces.el.VariableResolverImpl throws java.lang.IllegalStateException when it unsets the scope as null

Posted by Madhan Mohan <mo...@gmail.com>.
Hi All,

I didnot here any feedback from any MYFaces developer regarding to the below
MYFACES patch or code changes.I assume that the code changes are fine and go
ahead to implement.

Also It would be appreciated if any one can get a chance to review and give
feedback on below MYFACES Patch.

Thanks
Mohan R Siripi

On Mon, Jun 6, 2011 at 2:57 PM, Madhan Mohan <mo...@gmail.com> wrote:

> Hi,
>
> I am running an application in Geronimo 2.1.7 and that requires a valid
> scope, but what we see is java.lang.IllegalStateException during application
> startup
>
> Servlet.service() for servlet jsp  threw exception
> java.lang.IllegalStateException: unknown scope defined: null
>        at
> org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResol
> verImpl.java:71)
>        at
> org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(Vari
> ableResolverToELResolver.java:93)
>        at
> javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
> ---------------
> ---------------
> Servlet.service() for servlet jsp  threw exception
> java.lang.NullPointerException
>        at
> javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
>        at
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$3
> 01(FacesCompositeELResolver.java:46)
>        at
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$4.invoke
> (FacesCompositeELResolver.java:108)
>        at
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(F
> acesCompositeELResolver.java:148)
>        at
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue
> (FacesCompositeELResolver.java:104)
>        at
> javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
>
> I have created a small debug application and tested the scenario to find
> the valid scopes.It looks to be the scopes are available for the application
> and only thing is some how the scope value getting as null before a call
> made to org.apache.myfaces.el.VariableResolverImpl.resolveVariable and it
> leads the above exception.
>
> 11:25:26,650 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope  after
> setScope() is JSP.
> ..
> ..
> 11:25:26,652 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope  after
> setScope() is Faces.
> ....
> 11:25:26,652 XXXX Thread[http-0.0.0.0-8463-1,5,main]: scope  before
> unsetScope() is Faces.
> ...
>
> the following is the code snippet where it sets and unsets the scope
> values.
> try
>        {
>            setScope(requestMap);
>            super.setValue(context, base, property, val);
>        }
>        finally
>        {
>            unsetScope(requestMap);
>        }
>
> So to fix the above issue i made changes to the following code snippet in
> the FacesCompositeELResolver to put back previous scope value for
> application availability
>
> try
>        {
>            prevScope = getScope(requestMap);
>            setScope(requestMap);
>            super.setValue(context, base, property, val);
>        }
>        finally
>        {
>            if( prevScope != null){
>               setScope(requestMap, prevScope);
>            }else{
>               unsetScope(requestMap);
>            }
>        }
>
> Can any one review the changes made to the following patch for the above
> issue and provide your comments.
>
> https://issues.apache.org/jira/browse/MYFACES-3166
>
> Thanks
> Mohan R Siripi
>
>