changeset 11866:e3ac9940a2db

8078144: many nightly tests failed due to NoSuchMethodError: sun.management.ManagementFactoryHelper.getDiagnosticMXBean Reviewed-by: alanb, sla
author sjiang
date Tue, 21 Apr 2015 10:24:20 +0200
parents d0c4b334d583
children 35eb8ba7f6d8
files test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Mon Apr 20 08:45:54 2015 +0200
+++ b/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");
     }