myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1136612 - /myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java
Date Thu, 16 Jun 2011 19:13:31 GMT
Author: lu4242
Date: Thu Jun 16 19:13:30 2011
New Revision: 1136612

URL: http://svn.apache.org/viewvc?rev=1136612&view=rev
Log:
MYFACES-3166 org.apache.myfaces.el.VariableResolverImpl throws java.lang.IllegalStateException
when it unsets the scope as null

Modified:
    myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java

Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java?rev=1136612&r1=1136611&r2=1136612&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java
(original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/FacesCompositeELResolver.java
Thu Jun 16 19:13:30 2011
@@ -74,14 +74,23 @@ public final class FacesCompositeELResol
             return null;
         }
         final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+        Scope prevScope = null;
         try
         {
+            prevScope = getScope(requestMap);
             setScope(requestMap);
             return super.getCommonPropertyType(context, base);
         }
         finally
         {
-            unsetScope(requestMap);
+            if(prevScope != null)
+            {
+                setScope(requestMap, prevScope);
+            }
+            else
+            {
+                unsetScope(requestMap);
+            }
         }
 
     }
@@ -95,15 +104,24 @@ public final class FacesCompositeELResol
             return null;
         }
         final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+        Scope prevScope = null;
         try
         {
+            prevScope = getScope(requestMap);
             setScope(requestMap);
             return super.getFeatureDescriptors(context, base);
 
         }
         finally
         {
-            unsetScope(requestMap);
+            if(prevScope != null)
+            {
+                setScope(requestMap, prevScope);
+            }
+            else
+            {
+                unsetScope(requestMap);
+            }
         }
     }
 
@@ -116,14 +134,23 @@ public final class FacesCompositeELResol
             return null;
         }
         final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+        Scope prevScope = null;
         try
         {
+            prevScope = getScope(requestMap);
             setScope(requestMap);
             return super.getType(context, base, property);
         }
         finally
         {
-            unsetScope(requestMap);
+            if(prevScope != null)
+            {
+                setScope(requestMap, prevScope);
+            }
+            else
+            {
+                unsetScope(requestMap);
+            }
         }
     }
 
@@ -136,14 +163,23 @@ public final class FacesCompositeELResol
             return null;
         }
         final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+        Scope prevScope = null;
         try
         {
+            prevScope = getScope(requestMap);
             setScope(requestMap);
             return super.getValue(context, base, property);
         }
         finally
         {
-            unsetScope(requestMap);
+            if(prevScope != null)
+            {
+                setScope(requestMap, prevScope);
+            }
+            else
+            {
+                unsetScope(requestMap);
+            }
         }
     }
 
@@ -156,14 +192,23 @@ public final class FacesCompositeELResol
             return false;
         }
         final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+        Scope prevScope = null;
         try
         {
+            prevScope = getScope(requestMap);
             setScope(requestMap);
             return super.isReadOnly(context, base, property);
         }
         finally
         {
-            unsetScope(requestMap);
+            if(prevScope != null)
+            {
+                setScope(requestMap, prevScope);
+            }
+            else
+            {
+                unsetScope(requestMap);
+            }
         }
     }
 
@@ -176,15 +221,24 @@ public final class FacesCompositeELResol
             return;
         }
         final Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+        Scope prevScope = null;
         try
         {
+            prevScope = getScope(requestMap);
             setScope(requestMap);
             super.setValue(context, base, property, val);
 
         }
         finally
         {
-            unsetScope(requestMap);
+            if(prevScope != null)
+            {
+                setScope(requestMap, prevScope);
+            }
+            else
+            {
+                unsetScope(requestMap);
+            }
         }
     }
 
@@ -192,6 +246,16 @@ public final class FacesCompositeELResol
     {
         requestMap.put(SCOPE, _scope);
     }
+    
+    private Scope getScope(final Map<String, Object> requestMap)
+    {
+        return (Scope) requestMap.get(Scope.class.getName());
+    }
+
+    private void setScope(final Map<String, Object> requestMap, Scope prevScope)
+    {
+        requestMap.put(Scope.class.getName(), prevScope);
+    }
 
     private static void unsetScope(final Map<String, Object> requestMap)
     {



Mime
View raw message