Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-beta2
-
None
Description
> With a CheckboxList returning an array of strings, if this
> array has a length of 2 elements or more and the target class
> is not resolved in XWorkBasicConverter, a StackOverflow error
> is thrown. As a target class, you can take a TreeSet for instance.
>
> The involved code from XWorkBasicConverter, you can see where
> is the error :
>
> if (result == null) {
> if (value instanceof String[]) {
> String[] array = (String[]) value;
>
> if ((array != null) && (array.length == 1))
>
> // let's try to convert the first element only
> result = this.convertValue(context, o,
> member, s, value, toType);
> } else
> }
>
> I'm also wondering if resolving the target class with the
> following equality
> :
> } else if (toType == Set.class) {
> result = doConvertToSet(context, value);
> is not a little bit optimist,
> Set.class.isAssignableFrom(toType) would be maybe more relax
> to deal with inherited class.
>
> Another remark, what do you think of dealing the arrays in a
> generic way ... and using the type converter for the value itself :
>
> String[] -> Date[] would build a Date array by applying for
> each value the right converter (String -> Date)
>
> Hope it can help.
> I really enjoy WebWork2, above all because I'm a former struts user.
>
> Richard HALLIER
> Chef de projet
> richard.hallier@uniclick.org
> 01.40.12.41.52
> www.uniclick.org
> UNICLICK
Attachments
Issue Links
- is duplicated by
-
XW-136 Stack overflow when trying to convert arrays to Integer
- Closed