diff --git a/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java index 555dfdc918b10..43606144cd05e 100644 --- a/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java +++ b/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java @@ -35,7 +35,6 @@ import com.sun.jmx.mbeanserver.NamedObject; import com.sun.jmx.mbeanserver.Repository; import com.sun.jmx.mbeanserver.Repository.RegistrationContext; -import com.sun.jmx.mbeanserver.Util; import com.sun.jmx.remote.util.EnvHelp; import java.lang.ref.WeakReference; @@ -81,6 +80,8 @@ import javax.management.RuntimeOperationsException; import javax.management.loading.ClassLoaderRepository; +import sun.management.Util; + /** * This is the default class for MBean manipulation on the agent side. It * contains the methods necessary for the creation, registration, and diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java index ffd4d758759b0..882fcaf809b9f 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, 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 @@ -281,7 +281,7 @@ public void addMBean(final DynamicMBean object, ObjectName name, // Set domain to default if domain is empty and not already set if (dom.length() == 0) - name = Util.newObjectName(domain + name.toString()); + name = sun.management.Util.newObjectName(domain + name.toString()); // Do we have default domain ? if (dom == domain) { // ES: OK (dom & domain are interned) @@ -438,10 +438,9 @@ public Set query(ObjectName pattern, QueryExp query) { if (allNames) result.addAll(moiTb.values()); else - addAllMatching(moiTb, result, Util.newObjectName(domain + name.getCanonicalName())); + addAllMatching(moiTb, result, sun.management.Util.newObjectName(domain + name.getCanonicalName())); return result; } - if (!name.isDomainPattern()) { final Map moiTb = domainTb.get(dom2Match); if (moiTb == null) return Collections.emptySet(); diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Util.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Util.java index 81f306e1dbbee..8ef1c99052e8c 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Util.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, 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 @@ -43,13 +43,6 @@ import javax.management.ObjectName; public class Util { - public static ObjectName newObjectName(String string) { - try { - return new ObjectName(string); - } catch (MalformedObjectNameException e) { - throw new IllegalArgumentException(e); - } - } static Map newMap() { return new HashMap<>(); diff --git a/src/java.management/share/classes/javax/management/MBeanServerDelegate.java b/src/java.management/share/classes/javax/management/MBeanServerDelegate.java index f2346a04d5e28..df75fdce9efc9 100644 --- a/src/java.management/share/classes/javax/management/MBeanServerDelegate.java +++ b/src/java.management/share/classes/javax/management/MBeanServerDelegate.java @@ -28,7 +28,7 @@ import java.lang.System.Logger.Level; import com.sun.jmx.defaults.JmxProperties; import com.sun.jmx.defaults.ServiceName; -import com.sun.jmx.mbeanserver.Util; +import sun.management.Util; /** * Represents the MBean server from the management point of view. diff --git a/src/java.management/share/classes/javax/management/ObjectName.java b/src/java.management/share/classes/javax/management/ObjectName.java index 4bcda7f025285..f51037cbaf11c 100644 --- a/src/java.management/share/classes/javax/management/ObjectName.java +++ b/src/java.management/share/classes/javax/management/ObjectName.java @@ -1222,7 +1222,7 @@ public static ObjectName getInstance(String domain, public static ObjectName getInstance(ObjectName name) { if (name.getClass().equals(ObjectName.class)) return name; - return Util.newObjectName(name.getSerializedNameString()); + return sun.management.Util.newObjectName(name.getSerializedNameString()); } /** @@ -1813,7 +1813,7 @@ public static String unquote(String q) { * * @since 1.6 */ - public static final ObjectName WILDCARD = Util.newObjectName("*:*"); + public static final ObjectName WILDCARD = sun.management.Util.newObjectName("*:*"); // Category : Utilities <===================================