You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/07/25 21:29:22 UTC
(commons-beanutils) 13/23: Use valueOf()
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch 1.X
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
commit 0512e30397e56e76d851867d7e09ec29ec464222
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jul 25 17:20:23 2024 -0400
Use valueOf()
- Remove redundant parentheses
---
.../commons/beanutils/locale/converters/FloatLocaleConverter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverter.java b/src/main/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverter.java
index 5e2a1eb9..36f2cc84 100644
--- a/src/main/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverter.java
+++ b/src/main/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverter.java
@@ -217,10 +217,10 @@ public class FloatLocaleConverter extends DecimalLocaleConverter {
protected Object parse(final Object value, final String pattern) throws ParseException {
final Number parsed = (Number) super.parse(value, pattern);
final double doubleValue = parsed.doubleValue();
- final double posDouble = (doubleValue >= 0) ? doubleValue : (doubleValue * -1);
+ final double posDouble = doubleValue >= 0 ? doubleValue : doubleValue * -1;
if (posDouble != 0 && (posDouble < Float.MIN_VALUE || posDouble > Float.MAX_VALUE)) {
throw new ConversionException("Supplied number is not of type Float: "+parsed);
}
- return new Float(parsed.floatValue()); // unlike superclass it returns Float type
+ return Float.valueOf(parsed.floatValue()); // unlike superclass it returns Float type
}
}