Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8061616

HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double

XMLWordPrintable

        HotspotDiagnosticMXBean.getVMOption() fails looking up VM options of type double. This can be easily reproduced with the following test-patch:


        diff -r 3c4254d2df12 test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java
        --- a/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java Fri Oct 17 15:35:25 2014 -0700
        +++ b/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java Tue Oct 21 11:15:58 2014 +0200
        @@ -34,7 +34,7 @@
          */
         
         public class DoubleTest {
        - private static final String FLAG_NAME = null;
        + private static final String FLAG_NAME = "CompileThresholdScaling";
             private static final Double[] TESTS = {0d, -0d, -1d, 1d,
                     Double.MAX_VALUE, Double.MIN_VALUE, Double.NaN,
                     Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY};


        The output then looks like this:

        java.lang.RuntimeException: Expected null to equal 1.0
           at com.oracle.java.testlibrary.Asserts.error(Asserts.java:450)
           at com.oracle.java.testlibrary.Asserts.assertEquals(Asserts.java:166)
           at com.oracle.java.testlibrary.Asserts.assertEquals(Asserts.java:152)
           at com.oracle.java.testlibrary.Asserts.assertEQ(Asserts.java:133)
           at VmFlagTest.testPositive(VmFlagTest.java:95)
           at VmFlagTest$$Lambda$10/447683165.accept(Unknown Source)
           at VmFlagTest.test(VmFlagTest.java:77)
           at VmFlagTest.runTest(VmFlagTest.java:69)
           at VmFlagTest.runTest(VmFlagTest.java:63)
           at DoubleTest.main(DoubleTest.java:43)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
           at java.lang.Thread.run(Thread.java:745)

              jbachorik Jaroslav BachorĂ­k
              thartmann Tobias Hartmann
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: