JDK-8064579 : [cmm] MXBeanRequiresCommercialFeatures should be filtered when -XX:-UnlockCommercialFeatures is used
  • Type: Bug
  • Component: other-libs
  • Affected Version: 8u40,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2014-11-11
  • Updated: 2014-11-19
  • Resolved: 2014-11-19
Related Reports
Duplicate :  
Description
Test verify that CMM doesn't work without unlocking options. It fails when these options are forced externally. It is needed to skip it in such case.

Here is the fix:
diff -r c4f0dadaaa37 jdk/management/cmm/MXBeanRequiresCommercialFeatures.java
--- a/jdk/management/cmm/MXBeanRequiresCommercialFeatures.java	Fri Nov 07 09:22:58 2014 -0800
+++ b/jdk/management/cmm/MXBeanRequiresCommercialFeatures.java	Tue Nov 11 17:41:47 2014 +0300
@@ -11,6 +11,7 @@
  * @test
  * @bug 8062565
  * @summary Fail to acquire CMM MXBean impl w/o -XX:+UnlockCommercialFeatures
+ * @requires vm.opt.UnlockCommercialFeatures == "null" | vm.opt.UnlockCommercialFeatures == "false"
  * @run main MXBeanRequiresCommercialFeatures
  */
 public class MXBeanRequiresCommercialFeatures {
@@ -19,8 +20,7 @@
             MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
             SystemResourcePressureMXBean mbean = ManagementFactory
               .getPlatformMXBean(SystemResourcePressureMXBean.class);
-            throw new RuntimeException("Should have thrown IAE.  Running with "+
-                    "-XX:+UnlockCommercialFeatures?");
+            throw new RuntimeException("Should have thrown IAE.");
         } catch (IllegalArgumentException e) {
             System.out.println("IAE thrown - test passes");
         }

Comments
JDK-8064288 will include an update to the test case to handle this situation.
11-11-2014