--- old/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/DoubleJVMOption.java 2015-06-16 23:14:27.834721276 +0300 +++ new/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/DoubleJVMOption.java 2015-06-16 23:14:27.690721276 +0300 @@ -51,6 +51,8 @@ */ DoubleJVMOption(String name) { this.name = name; + min = Double.MIN_VALUE; + max = Double.MAX_VALUE; } /** @@ -83,7 +85,7 @@ */ @Override String getMin() { - return String.format("%f", min); + return formatValue(min); } /** @@ -103,9 +105,13 @@ */ @Override String getMax() { - return String.format("%f", max); + return formatValue(max); } - + + private String formatValue(double value) { + return String.format("%f", value); + } + /** * Return list of strings with valid option values which used for testing * using jcmd, attach and etc. @@ -116,22 +122,22 @@ protected List getValidValues() { List validValues = new ArrayList<>(); - validValues.add(String.format("%f", min)); - validValues.add(String.format("%f", max)); + validValues.add(formatValue(min)); + validValues.add(formatValue(max)); if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_NEGATIVE) < 0) && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_NEGATIVE) > 0)) { - validValues.add(String.format("%f", ADDITIONAL_TEST_DOUBLE_NEGATIVE)); + validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_NEGATIVE)); } if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_ZERO) < 0) && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_ZERO) > 0)) { - validValues.add(String.format("%f", ADDITIONAL_TEST_DOUBLE_ZERO)); + validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_ZERO)); } if ((Double.compare(min, ADDITIONAL_TEST_DOUBLE_POSITIVE) < 0) && (Double.compare(max, ADDITIONAL_TEST_DOUBLE_POSITIVE) > 0)) { - validValues.add(String.format("%f", ADDITIONAL_TEST_DOUBLE_POSITIVE)); + validValues.add(formatValue(ADDITIONAL_TEST_DOUBLE_POSITIVE)); } return validValues; @@ -147,23 +153,26 @@ protected List getInvalidValues() { List invalidValues = new ArrayList<>(); - if (Double.compare(min, Double.MIN_VALUE) != 0) { - if ((Double.compare(min, 0.0) > 0) - && (Double.isNaN(min * 0.999) == false)) { - invalidValues.add(String.format("%f", min * 0.999)); - } else if ((Double.compare(min, 0.0) < 0) - && (Double.isNaN(min * 1.001) == false)) { - invalidValues.add(String.format("%f", min * 1.001)); + if (withRange) { + /* Return invalid values only for options which have defined range in VM */ + if (Double.compare(min, Double.MIN_VALUE) != 0) { + if ((Double.compare(min, 0.0) > 0) + && (Double.isNaN(min * 0.999) == false)) { + invalidValues.add(formatValue(min * 0.999)); + } else if ((Double.compare(min, 0.0) < 0) + && (Double.isNaN(min * 1.001) == false)) { + invalidValues.add(formatValue(min * 1.001)); + } } - } - if (Double.compare(max, Double.MAX_VALUE) != 0) { - if ((Double.compare(max, 0.0) > 0) - && (Double.isNaN(max * 1.001) == false)) { - invalidValues.add(String.format("%f", max * 1.001)); - } else if ((Double.compare(max, 0.0) < 0) - && (Double.isNaN(max * 0.999) == false)) { - invalidValues.add(String.format("%f", max * 0.999)); + if (Double.compare(max, Double.MAX_VALUE) != 0) { + if ((Double.compare(max, 0.0) > 0) + && (Double.isNaN(max * 1.001) == false)) { + invalidValues.add(formatValue(max * 1.001)); + } else if ((Double.compare(max, 0.0) < 0) + && (Double.isNaN(max * 0.999) == false)) { + invalidValues.add(formatValue(max * 0.999)); + } } }