garydgregory commented on code in PR #404:
URL: https://github.com/apache/commons-beanutils/pull/404#discussion_r3477140215
##########
src/test/java/org/apache/commons/beanutils2/converters/FloatConverterTest.java:
##########
@@ -70,11 +70,17 @@ void testInvalidAmount() {
final Converter<Float> converter = makeConverter();
final Class<?> clazz = Float.class;
final Double max = Double.valueOf(Float.MAX_VALUE);
+ final Double min = Double.valueOf(-Float.MAX_VALUE);
final Double tooBig = Double.valueOf(Double.MAX_VALUE);
+ final Double tooSmall = Double.valueOf(-Double.MAX_VALUE);
// Maximum
assertEquals(Float.valueOf(Float.MAX_VALUE), converter.convert(clazz,
max), "Maximum");
+ // Minimum
+ assertEquals(Float.valueOf(-Float.MAX_VALUE), converter.convert(clazz,
min), "Minimum");
Review Comment:
Why are we not using MIN_VALUE here?
##########
src/main/java/org/apache/commons/beanutils2/converters/NumberConverter.java:
##########
@@ -457,6 +463,9 @@ private <T> T toNumber(final Class<?> sourceType, final
Class<T> targetType, fin
if (value.doubleValue() > Float.MAX_VALUE) {
throw ConversionException.format("%s value '%s' is too large
for %s", toString(sourceType), value, toString(targetType));
}
+ if (value.doubleValue() < -Float.MAX_VALUE) {
Review Comment:
Why are we not using `MIN_VALUE` here?
--
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]