struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Sachs (JIRA)" <>
Subject [jira] [Commented] (WW-4240) TypeConversionErrors with Maps
Date Fri, 24 Jan 2014 16:31:38 GMT


Andreas Sachs commented on WW-4240:

i further investigate this issue. My assumption that the validate-method is not called after
a type conversion error for an Integer field is not true.

But there is still a difference:
If there is a type conversion error for an Integer field, the field is null.
If there is a type conversion error for a Map<Integer,Integer>, the map will contain
a String-Element with the value "ognl.NoConversionPossible".
That means if you access the map with e.g. Integer i = map.get(0) you will get a class cast
Maybe this map entry should be set to null instead.

> TypeConversionErrors with Maps
> ------------------------------
>                 Key: WW-4240
>                 URL:
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions:
>            Reporter: Andreas Sachs
>            Priority: Minor
>             Fix For: 2.3.17
> Hello,
> i have an action with the following map definition:
> private Map<Integer, Integer> baelle;
> The jsp contains textfields.
> If the user enters a String instead of an Integer, the map contains a String-Element
with the value "ognl.NoConversionPossible". The validation method is called.
> If i have an Integer property and the user enters a String, the validation method is
not called. Instead the input-page is shown again. I would expect the same behaviour with
a map.
> Thanks
> Andreas

This message was sent by Atlassian JIRA

View raw message