8078144: many nightly tests failed due to NoSuchMethodError: sun.management.ManagementFactoryHelper.getDiagnosticMXBean
authorsjiang
Tue, 21 Apr 2015 10:24:20 +0200
changeset 30358 15b7f8ff367c
parent 30357 6c0dc3853096
child 30359 b2b7b66cd9eb
8078144: many nightly tests failed due to NoSuchMethodError: sun.management.ManagementFactoryHelper.getDiagnosticMXBean Reviewed-by: alanb, sla
jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java
--- a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Mon Apr 20 08:45:54 2015 +0200
+++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Tue Apr 21 10:24:20 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,8 @@
  * questions.
  */
 
-import sun.management.ManagementFactoryHelper;
-
+import java.lang.management.ManagementFactory;
 import com.sun.management.HotSpotDiagnosticMXBean;
-
 import jdk.testlibrary.OutputAnalyzer;
 import static jdk.testlibrary.Platform.isSolaris;
 import static jdk.testlibrary.Asserts.assertEquals;
@@ -114,13 +112,15 @@
     }
 
     private static void verifyIsEnabled(String flag) {
-        HotSpotDiagnosticMXBean hotspotDiagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+        HotSpotDiagnosticMXBean hotspotDiagnostic =
+                ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
         String flagValue = hotspotDiagnostic.getVMOption(flag).getValue();
         assertEquals(flagValue, "true", "Expected '" + flag + "' flag be enabled");
     }
 
     private static void verifyIsDisabled(String flag) {
-        HotSpotDiagnosticMXBean hotspotDiagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+        HotSpotDiagnosticMXBean hotspotDiagnostic =
+                ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
         String flagValue = hotspotDiagnostic.getVMOption(flag).getValue();
         assertEquals(flagValue, "false", "Expected '" + flag + "' flag be disabled");
     }