DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18297>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18297 StringArrayConvertor does not convert int[] to String[] Summary: StringArrayConvertor does not convert int[] to String[] Product: Commons Version: Nightly Builds Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Bean Utilities AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I would only report this bug with knowledge that an inconsistency exists in the BeanUtils converters. When using the converter IntegerArrayConverter, the converter attempts to parse a String[] to an int[], however it makes no attempt to do the far easier conversion from int[] to String[] in StringArrayConverter. This happens to be a very important conversion since multiple select boxes in html forms must be set at a string array even though the model often transfers data to the form as an int[]. The two conversions are equally important and it is, in my mind, a missing feature that the conversion exists in one case and not in the other. The follow is the necessary patch to add this convertor. --- StringArrayConverter.java.orig 2003-03-21 04:43:17.000000000 -0500 +++ StringArrayConverter.java 2003-03-21 04:43:20.000000000 -0500 @@ -113,6 +113,10 @@ // ------------------------------------------------------- Static Variables + /** + * <p> Model object for int arrays.</p> + */ + private static int ints[] = new int[0]; /** * <p>Model object for type comparisons.</p> @@ -149,6 +153,19 @@ return (value); } + // Deal with the input value as an int array + if (ints.getClass() == value.getClass()) + { + int[] values = (int[]) value; + String[] results = new String[values.length]; + for (int i = 0; i < values.length; i++) + { + results[i] = new StringBuffer().append(values[i]).toString(); + } + + return (results); + } + // Parse the input value as a String into elements // and convert to the appropriate type try { As you can see, the added functionality is copied almost directly from IntegerArrayConverter. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]