Author: markt
Date: Sun Jul 14 17:57:06 2013
New Revision: 1503006

URL: http://svn.apache.org/r1503006
Log:
Special handling to handle the ambiguity of {} which could be an empty Set or 
an empty Map

Modified:
    tomcat/trunk/java/org/apache/el/lang/ELSupport.java

Modified: tomcat/trunk/java/org/apache/el/lang/ELSupport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ELSupport.java?rev=1503006&r1=1503005&r2=1503006&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/lang/ELSupport.java (original)
+++ tomcat/trunk/java/org/apache/el/lang/ELSupport.java Sun Jul 14 17:57:06 2013
@@ -21,6 +21,9 @@ import java.beans.PropertyEditor;
 import java.beans.PropertyEditorManager;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
 
 import javax.el.ELException;
 
@@ -417,6 +420,14 @@ public class ELSupport {
                 return editor.getValue();
             }
         }
+
+        // Handle special case because the syntax for the empty set is the same
+        // for an empty map. The parser will always parse {} as an empty set.
+        if (obj instanceof Set && type == Map.class &&
+                ((Set<?>) obj).isEmpty()) {
+            return Collections.EMPTY_MAP;
+        }
+
         throw new ELException(MessageFactory.get("error.convert",
                 obj, obj.getClass(), type));
     }



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

Reply via email to