Mantis - Resin
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
2451 | major | always | 02-20-08 04:09 | 03-05-08 15:37 | |
|
|||||
Reporter: | anloci | Platform: | |||
Assigned To: | ferg | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 3.1.4 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.1.6 | ||
|
|||||
Summary: | 0002451: In EL lib getType(...) must not be getValue(...).getClass() | ||||
Description: |
I'm working with JSF 1.2 with the following example: BEANS: public class Register { ... protected Tutorial[] tutorials=null; public Tutorial[] getTutorials() { ... } public void setTutorials(Tutorial[] tutorials) { ... } } public class RegistrationInfo { public Tutorial[] getTutorials() { ... } } CONVERTER: public class TutorialConverter implements Converter { public Object getAsObject(FacesContext ctxt, UIComponent component, String str) throws ConverterException { Tutorial tutorial=null; ... return tutorial; } public String getAsString(FacesContext ctxt, UIComponent component, Object value) throws ConverterException { String str=null; Tutorial tutorial=(Tutorial)value; ... return str; } } JSF FORM: <f:view> <h:form id="form1"> ... <h:selectManyCheckbox id="tuts" value="#{register.tutorials}"> <f:converter converterId="TutorialConverter" /> <f:selectItem itemValue="#{RegistrationInfo.tutorials[0]}" itemLabel="Tutorial 1"/> <f:selectItem itemValue="#{RegistrationInfo.tutorials[1]}" itemLabel="Tutorial 2"/> <f:selectItem itemValue="#{RegistrationInfo.tutorials[2]}" itemLabel="Tutorial 3"/> </h:selectManyCheckbox> <h:commandButton action="check" value="Submit" /> </h:form> </f:view> MANAGED BEANS: <managed-bean> <managed-bean-name>registrationForm</managed-bean-name> <managed-bean-class>Register</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>RegistrationInfo</managed-bean-name> <managed-bean-class>RegistrationInfo</managed-bean-class> <managed-bean-scope>application</managed-bean-scope> </managed-bean> SEQUENCE: When I submit the form with some boxes checked with some tutorials, Resin (through JSF) raise me an "java.lang.IllegalArgumentException - argument type mismatch" exception. PROBLEM: After debuging the submision of the form I detected that: when the JSF implementation (MyFaces 1.2.2) ask for the type of the expresion '#register.tutorials' (delegated to the implementation of the EL lib), return a null value because the implementation of the method getType(...) (lines 467-477) is: package com.caucho.el; ... public abstract class Expr extends ValueExpression { ... public Class<?> getType(ELContext context) throws PropertyNotFoundException, ELException { Object value = getValue(context); if (value == null) return null; else return value.getClass(); } ... } because the method returns a null value, the implementation of JSF tries to call the method setTutorials using as parameter an Object[] class... so, it fails. The origin of the problem is because the implementation of getType(...) calls getValue(...).getClass() and that implementation is not complete. |
||||
Steps To Reproduce: | |||||
Additional Information: |
I solve manually the problem: 1) changing some implementation of some classes adding a getType method. P.e: com.caucho.el.ArrayResolverExpr @Override public Class<?> getType(ELContext env) throws ELException { Object aObj = _left.getValue(env); if (aObj == null) return null; Object fieldObj = _right.getValue(env); if (fieldObj == null) return null; return env.getELResolver().getType(env, aObj, fieldObj); } com.caucho.el.PathExpr @Override public Class<?> getType(ELContext env) throws ELException { Class<?> type = _expr.getType(env); if (type != null) return type; return env.getELResolver().getType(env, _path, null); } 2) Including the el-api.jar library from Tomcat 6.0.16. Because the implementation of the method getType(...) in javax.el.CompositeELResolver returns the correct class, Tutotrial[]. The implementation given in resin return a null value. |
||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|