On 6/23/07, Martin van den Bemt <[EMAIL PROTECTED]> wrote:
Noticed the call of toString() on a String during the huntdown of what in beanutils broke the betwixt tests. (in the TestObjectStringConverters) The commit was a bit premature probably, although this is most (read most, so not all) of the time faster that calling toString() on a String. Will revert it (after some sleep) if that is what you are asking (code is more readable without the addition, agreed).
Sorry was grmupy earlier - I leave it up to you.
Another questions (probably related to BEANUTILS-258) : The failing gump of betwixt is related to the changes you made to ConvertUtilsBean.convert(Object). In beanutils 1.7 a default lookup is done for the type String.class and in the new code this is just the case when no converter can be found for the sourcetype, which makes the new beanutils code not a drop in replacement of the old one and not backward compatible. I will see if I can run the beanutils 1.7 testcases against trunk tomorrow (they should pass, or am I being simplistic here?) Was this breakage intended and what are your thoughts on how to handle this ?
I'm not familiar with betwixt - but I will look at this - hopefully sometme this weekend. Niall
Mvgr, Martin Niall Pemberton wrote: > Is there a reason for this change? AFAIK calling toString() on a > String object just returns a reference to itself - so this just seems > to add clutter in my mind. Also there was discussion on this (i.e. > calling toString() on a String) for this very bit of code in the > following issue ticket - would have been nice to comment before > arbitarily making the change > > http://issues.apache.org/jira/browse/BEANUTILS-283 > > Niall > > On 6/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Author: mvdb >> Date: Fri Jun 22 17:58:02 2007 >> New Revision: 549986 >> >> URL: http://svn.apache.org/viewvc?view=rev&rev=549986 >> Log: >> Prevent calling toString on a String. >> >> Modified: >> >> jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ConvertUtilsBean.java >> >> >> Modified: >> jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ConvertUtilsBean.java >> >> URL: >> http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ConvertUtilsBean.java?view=diff&rev=549986&r1=549985&r2=549986 >> >> ============================================================================== >> >> --- >> jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ConvertUtilsBean.java >> (original) >> +++ >> jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ConvertUtilsBean.java >> Fri Jun 22 17:58:02 2007 >> @@ -542,7 +542,8 @@ >> } >> converted = converter.convert(targetType, value); >> } >> - if (targetType == String.class && converted != null) { >> + if (targetType == String.class && converted != null && >> + !(converted instanceof String)) { >> converted = converted.toString(); >> } >> return converted; >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]