Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3166

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.8
    • Fix Version/s: 1.2.11, 2.0.8, 2.1.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux
      Geronimo 2.1.7

      Description

      I am running an application in Geronimo 2.1.7 that requires valid scope and it fails with the following exception

      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)

      After investigating on codebase i see that the following is the code snippet where one thread sets the scope and some other thread on the same context unsets scope to null before a call made to org.apache.myfaces.el.VariableResolverImpl.resolveVariable and it leads the above exception

      try

      { setScope(requestMap); super.setValue(context, base, property, val); }

      finally

      { unsetScope(requestMap); }

      So to fix the scope i have changed the following code snippet in the FacesCompositeELResolver to put back previous scope value

      try

      { tmpScope = getScope(requestMap); setScope(requestMap); super.setValue(context, base, property, val); }

      finally
      {
      if( tmpScope != null)

      { setScope(requestMap, tmpScope); }

      else

      { unsetScope(requestMap); }

      }

      I am attaching the code with all the changes to fix this issue.Please review and provide your comments.

        Attachments

          Activity

            People

            • Assignee:
              lu4242 Leonardo Uribe
              Reporter:
              mohan.siripi Mohan Reddy
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: