garydgregory commented on PR #411:
URL:
https://github.com/apache/commons-beanutils/pull/411#issuecomment-4895679994
Hi @rootvector2
Hm, my initial reaction was: This might break a bunch of existing call sites
that rely on mapping a `"5.5"` input to `5`.
Then looking at the Javadoc of, for example, `IntegerLocaleConverter`, we
read:
```java
/**
* Standard {@link org.apache.commons.beanutils2.locale.LocaleConverter}
implementation that converts an incoming locale-sensitive String into a {@link
Integer}
* object, optionally using a default value or throwing a {@link
org.apache.commons.beanutils2.ConversionException} if a conversion error occurs.
*/
public class IntegerLocaleConverter extends DecimalLocaleConverter<Integer> {
```
Specifically: "optionally using a default value or throwing a
ConversionException if a conversion error occurs."
Which begs the question, when do you map a conversion error to the default
value and when do you map it to throwing a ConversionException?
Do you have any thoughts here? We have some leeway for changing behavior and
APIs in master since 2.0 isn't out yet but a 1.X version of this PR would need
to be least surprising.
So focusing on master, and looking at
`org.apache.commons.beanutils2.locale.BaseLocaleConverter`, I'm starting to
think that the use of default values is pretty narrow.
WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]