https://issues.apache.org/bugzilla/show_bug.cgi?id=52393
Bug #: 52393 Summary: MapELResolver.getType always returns Object.class instead of the real type Product: Tomcat 7 Version: 7.0.22 Platform: PC OS/Version: Linux Status: NEW Severity: blocker Priority: P2 Component: Servlet & JSP API AssignedTo: dev@tomcat.apache.org ReportedBy: qiuyunzh...@hotmail.com Classification: Unclassified I upgrade my tomcat from 7.0.12 to 7.0.22 for my Myfaces web application. Here is all related apps' version. tomcat: 7.0.22 Myfaces: 1.2.9 Spring: 3.6 Os: Cent OS 5.4/Ubuntu 11/ Windows JRE:1.6.0.30/1.6.0.24 Scenario: My application runs smooth for more than one months on tomcat 7.0.12. Due to security consern, I upgrade tomcat to 7.0.22. At first, it seems everything is ok. However, there is a jsp page using Myfaces' datatable components. Once I submit the datatable to back bean. It throws a ClassCastException, which always says that a MyClass could not be casted to List<MyClass>. After traced the code step by step, I found it's caused by MapElResolver.getType(ELContext context, Object base, Object property). Here is the 7.0.22 version implementation: public Class<?> getType(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, ELException { if (context == null) { throw new NullPointerException(); } if (base instanceof Map<?,?>) { context.setPropertyResolved(true); return Object.class; } return null; } In fact, in version 7.0.12 the implementation is: public Class<?> getType(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, ELException { if (context == null) { throw new NullPointerException(); } if (base instanceof Map<?,?>) { context.setPropertyResolved(true); Object obj = ((Map<?,?>) base).get(property); return (obj != null) ? obj.getClass() : null; } return null; } You see, in the new version, it doesn't return the value of Map's specific type, but only the base Object type. This effects org.apache.myfaces.component.html.ext.updateModelFromPreservedDataModel.updateModelFromPreservedDataModel(FacesContext context) to only get the first element of the list to set to its back bean's attribute and finally leads to ClassCastException. Not sure why change the getType method and it definitely not the correct function. Thanks a lot. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org