Revert "LANG-1289" type="fix" dev="ggregory">JavaVersion class depends on Apache Commons Math class NumberUtils."

This reverts commit 9dcd87f9c4.
This commit is contained in:
Gary Gregory 2016-11-18 13:36:09 -08:00
parent 9dcd87f9c4
commit f55530a2ff
2 changed files with 4 additions and 37 deletions

View File

@ -57,7 +57,6 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1070" type="fix" dev="pschumacher" due-to="Paul Pogonyshev">ArrayUtils#add confusing example in javadoc</action> <action issue="LANG-1070" type="fix" dev="pschumacher" due-to="Paul Pogonyshev">ArrayUtils#add confusing example in javadoc</action>
<action issue="LANG-1271" type="fix" dev="pschumacher" due-to="Pierre Templier">StringUtils#isAnyEmpty and #isAnyBlank should return false for an empty array</action> <action issue="LANG-1271" type="fix" dev="pschumacher" due-to="Pierre Templier">StringUtils#isAnyEmpty and #isAnyBlank should return false for an empty array</action>
<action issue="LANG-1155" type="fix" dev="pschumacher" due-to="Saif Asif, Thiago Andrade">Add StringUtils#unwrap</action> <action issue="LANG-1155" type="fix" dev="pschumacher" due-to="Saif Asif, Thiago Andrade">Add StringUtils#unwrap</action>
<action issue="LANG-1289" type="fix" dev="ggregory">JavaVersion class depends on Apache Commons Math class NumberUtils</action>
<action issue="LANG-1034" type="add" dev="pschumacher" due-to="Yathos UG">Add support for recursive comparison to EqualsBuilder#reflectionEquals</action> <action issue="LANG-1034" type="add" dev="pschumacher" due-to="Yathos UG">Add support for recursive comparison to EqualsBuilder#reflectionEquals</action>
<action issue="LANG-740" type="add" dev="pschumacher" due-to="James Sawle">Implementation of a Memomizer</action> <action issue="LANG-740" type="add" dev="pschumacher" due-to="James Sawle">Implementation of a Memomizer</action>
<action issue="LANG-1258" type="add" dev="pschumacher" due-to="IG, Grzegorz Rożniecki">Add ArrayUtils#toStringArray method</action> <action issue="LANG-1258" type="add" dev="pschumacher" due-to="IG, Grzegorz Rożniecki">Add ArrayUtils#toStringArray method</action>

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.commons.lang3; package org.apache.commons.lang3;
import org.apache.commons.lang3.math.NumberUtils;
/** /**
* <p>An enum representing all the versions of the Java specification. * <p>An enum representing all the versions of the Java specification.
* This is intended to mirror available values from the * This is intended to mirror available values from the
@ -218,45 +220,11 @@ public enum JavaVersion {
if (value.contains(".")) { if (value.contains(".")) {
final String[] toParse = value.split("\\."); final String[] toParse = value.split("\\.");
if (toParse.length >= 2) { if (toParse.length >= 2) {
return toFloat(toParse[0] + '.' + toParse[1], defaultReturnValue); return NumberUtils.toFloat(toParse[0] + '.' + toParse[1], defaultReturnValue);
} }
} else { } else {
return toFloat(value, defaultReturnValue); return NumberUtils.toFloat(value, defaultReturnValue);
} }
return defaultReturnValue; return defaultReturnValue;
} }
/**
* <p>Convert a <code>String</code> to a <code>float</code>, returning a
* default value if the conversion fails.</p>
*
* <p>If the string <code>str</code> is <code>null</code>, the default
* value is returned.</p>
*
* <pre>
* NumberUtils.toFloat(null, 1.1f) = 1.0f
* NumberUtils.toFloat("", 1.1f) = 1.1f
* NumberUtils.toFloat("1.5", 0.0f) = 1.5f
* </pre>
*
* @param str the string to convert, may be <code>null</code>
* @param defaultValue the default value
* @return the float represented by the string, or defaultValue
* if conversion fails
*
* <p>
* Copied from Apache Commons Math.
* </p>
*/
private static float toFloat(final String str, final float defaultValue) {
if (str == null) {
return defaultValue;
}
try {
return Float.parseFloat(str);
} catch (final NumberFormatException nfe) {
return defaultValue;
}
}
} }