LANG-1252: replacing system call for java 1.6 to SystemUtils.IS_JAVA_1_6
This commit is contained in:
parent
a266068798
commit
b3c31a379e
|
@ -21,6 +21,7 @@ import java.math.BigDecimal;
|
|||
import java.math.BigInteger;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
/**
|
||||
|
@ -1407,8 +1408,6 @@ public class NumberUtils {
|
|||
boolean hasDecPoint = false;
|
||||
boolean allowSigns = false;
|
||||
boolean foundDigit = false;
|
||||
boolean isJava6 = StringUtils.startsWith(
|
||||
System.getProperty("java.version"), "1.6");
|
||||
// deal with any possible sign up front
|
||||
final int start = (chars[0] == '-' || chars[0] == '+') ? 1 : 0;
|
||||
final boolean hasLeadingPlusSign = (start == 1 && chars[0] == '+');
|
||||
|
@ -1481,7 +1480,7 @@ public class NumberUtils {
|
|||
}
|
||||
if (i < chars.length) {
|
||||
if (chars[i] >= '0' && chars[i] <= '9') {
|
||||
if (isJava6 && hasLeadingPlusSign && !hasDecPoint) {
|
||||
if (SystemUtils.IS_JAVA_1_6 && hasLeadingPlusSign && !hasDecPoint) {
|
||||
return false;
|
||||
}
|
||||
// no type qualifier, OK
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.math.BigDecimal;
|
|||
import java.math.BigInteger;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
|
@ -1298,7 +1299,7 @@ public class NumberUtilsTest {
|
|||
@Test
|
||||
public void testLANG1252() {
|
||||
//Check idiosyncries between java 1.6 and 1.7,1.8 redarding leading + signs
|
||||
if (StringUtils.startsWith(System.getProperty("java.version"), "1.6")) {
|
||||
if (SystemUtils.IS_JAVA_1_6) {
|
||||
compareIsCreatableWithCreateNumber("+2", false);
|
||||
} else {
|
||||
compareIsCreatableWithCreateNumber("+2", true);
|
||||
|
|
Loading…
Reference in New Issue