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)) {
value = array[0];
}
// let's try to convert the first element only
result = this.convertValue(context, o, member, s, value,
toType);
} else {
result = super.convertValue(context, value, toType);
}
}
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
[EMAIL PROTECTED]
01.40.12.41.52
www.uniclick.org
UNICLICK
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork