tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: EL Resolver throws InvocationTargetException (char-long conversation)
Date Mon, 11 Jun 2012 09:34:32 GMT
On 11/06/2012 10:31, burghard.britzke wrote:
> But it for in common the El-Resolver should be able to convert the 'w' into a java.lang.Long
in this case.
> May be this is an issue with Tomcat 7.0.27?
> Should somebody (may be I) file this at https://issues.apache.org/ ?

No. There is no bug here. You need to read the EL specification more
carefully.

In EL, 'w' is not a char, but a String of length 1.

Mark

> 
> Sincerly,
> burghard.britzke
> 
> Am 11.06.2012 um 11:22 schrieb burghard.britzke:
> 
>> Thank you!
>> your tip did it. I changed the property type to string because 119 is more ambigous
than 'w' in this case.
>>
>> Sincerly,
>> burghard.britzke
>>
>> Am 11.06.2012 um 09:58 schrieb Konstantin Kolinko:
>>
>>> 2012/6/11 burghard.britzke <bubi@charmides.in-berlin.de>:
>>>> with tomcat 7.0.27, primefaces 3.3, myfaces 2.1.17, weld 1.1.8
>>>>
>>>> for the jsf-source
>>>> Line 56: <h:graphicImage
>>>> Line 57:    value="/images/#{personenBean.aktuellePerson.geschlecht eq 'w'
? 'fe':''}male.png">
>>>> Line 58: </h:graphicImage>
>>>>
>>>> and the bean
>>>> public class Person implements Serializable {
>>>>       @Column(name = "\"geschlecht\"", nullable = false, length = 1)
>>>>       private char geschlecht;
>>>> ...
>>>>
>>>> an Exception is thrown
>>>>
>>>> java.lang.reflect.InvocationTargetException
>>>> Caused by:<br/>javax.el.ELException - Cannot convert w of type class
java.lang.String to class java.lang.Long
>>>> at org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:304)
>>>> personen.xhtml at line 57 and column 92    value="/images/#{personenBean.aktuellePerson.geschlecht
eq 'w' ? 'fe':''}male.png"
>>>>
>>>> At MyFaces Discussion <users@myfaces.apache.org> they told me this
would probably be an issue with tomcat so I downgraded to Tomcat 7.0.25 and the error disappeared.
>>>> What are the next steps to get rid of this exception with Tomacat 7.0.27?
>>>>
>>>
>>> Yes, Tomcat behaviour changed and new behaviour follows the EL
>>> specification more closely. It was because of this bug report:
>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=52666
>>>
>>> See EL specification for more details.
>>>
>>> According to EL 2.2 ch. 1.18.3 coercion from char to a number is performed as
>>> "If A is Character, convert A to new Short((short)a.charValue()) ..."
>>>
>>> so you have to s/'w'/119/.
>>>
>>> There might be other workarounds, such as
>>> a) Add another property to that bean that will return the value as String
>>> b) Use a function such as fn:trim() from JSTL to force conversion of
>>> that value into String.
>>>
>>> Best regards,
>>> Konstantin Kolinko
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Mime
View raw message