tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1101094 - in /tomcat/trunk: java/javax/el/MapELResolver.java test/org/apache/el/TestValueExpressionImpl.java webapps/docs/changelog.xml
Date Mon, 09 May 2011 16:31:04 GMT
Author: markt
Date: Mon May  9 16:31:03 2011
New Revision: 1101094

URL: http://svn.apache.org/viewvc?rev=1101094&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51177
MapElResolver should always return Object.class for getType()

Modified:
    tomcat/trunk/java/javax/el/MapELResolver.java
    tomcat/trunk/test/org/apache/el/TestValueExpressionImpl.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/javax/el/MapELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/MapELResolver.java?rev=1101094&r1=1101093&r2=1101094&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/MapELResolver.java (original)
+++ tomcat/trunk/java/javax/el/MapELResolver.java Mon May  9 16:31:03 2011
@@ -64,8 +64,7 @@ public class MapELResolver extends ELRes
 
         if (base instanceof Map<?,?>) {
             context.setPropertyResolved(true);
-            Object obj = ((Map<?,?>) base).get(property);
-            return (obj != null) ? obj.getClass() : null;
+            return Object.class;
         }
         
         return null;

Modified: tomcat/trunk/test/org/apache/el/TestValueExpressionImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestValueExpressionImpl.java?rev=1101094&r1=1101093&r2=1101094&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestValueExpressionImpl.java (original)
+++ tomcat/trunk/test/org/apache/el/TestValueExpressionImpl.java Mon May  9 16:31:03 2011
@@ -17,6 +17,9 @@
 
 package org.apache.el;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.el.ELContext;
 import javax.el.ExpressionFactory;
 import javax.el.ValueExpression;
@@ -104,4 +107,30 @@ public class TestValueExpressionImpl ext
         String result2 = (String) ve2.getValue(context);
         assertEquals("fooAPPLEbar", result2);
     }
+
+    public void testBug51177ObjectMap() {
+        ExpressionFactory factory = ExpressionFactory.newInstance();
+        ELContext context = new ELContextImpl();
+        
+        Object o1 = "String value";
+        Object o2 = new Integer(32);
+
+        Map<Object,Object> map = new HashMap<Object,Object>();
+        map.put("key1", o1);
+        map.put("key2", o2);
+        
+        ValueExpression var =
+            factory.createValueExpression(map, Map.class);
+        context.getVariableMapper().setVariable("map", var);
+
+        ValueExpression ve1 = factory.createValueExpression(
+                context, "${map.key1}", Object.class);
+        ve1.setValue(context, o2);
+        assertEquals(o2, ve1.getValue(context));
+        
+        ValueExpression ve2 = factory.createValueExpression(
+                context, "${map.key2}", Object.class);
+        ve2.setValue(context, o1);
+        assertEquals(o1, ve2.getValue(context));
+    }
 }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1101094&r1=1101093&r2=1101094&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon May  9 16:31:03 2011
@@ -75,7 +75,16 @@
         Ensure session cookie paths end in <code>/</code> so that session
         cookies created for a context with a path of <code>/foo</code> do not
         get returned with requests mapped to a context with a path of
-        <code>/foobar</code>. (markt)  
+        <code>/foobar</code>. (markt)
+      </fix>
+    </changelog>
+  </subsection>
+  <subsection name="Jasper">
+    <changelog>
+      <fix>
+        <bug>51177</bug>: Ensure Tomcat&apos;s MapElResolver always returns
+        <code>Object.class</code> for <code>getType()</code> as required
by the
+        EL specification. (markt)
       </fix>
     </changelog>
   </subsection>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message