Skip to content

Commit 8c238ed

Browse files
committed
8318707: Remove the Java Management Extension (JMX) Management Applet (m-let) feature
Reviewed-by: sspitsyn, dfuchs
1 parent cd0fe37 commit 8c238ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+139
-3490
lines changed

src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java

+4-26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -44,24 +44,14 @@ private JmxProperties() {
4444
//------------------------
4545

4646
/**
47-
* References the property that specifies the directory where
48-
* the native libraries will be stored before the MLet Service
49-
* loads them into memory.
47+
* References the property that optionally specifies the class name
48+
* of an alternative MBeanServerBuilder.
5049
* <p>
51-
* Property Name: <B>jmx.mlet.library.dir</B>
50+
* Property Name: <B>javax.management.builder.initial</B>
5251
*/
5352
public static final String JMX_INITIAL_BUILDER =
5453
"javax.management.builder.initial";
5554

56-
/**
57-
* References the property that specifies the directory where
58-
* the native libraries will be stored before the MLet Service
59-
* loads them into memory.
60-
* <p>
61-
* Property Name: <B>jmx.mlet.library.dir</B>
62-
*/
63-
public static final String MLET_LIB_DIR = "jmx.mlet.library.dir";
64-
6555
/**
6656
* References the property that specifies the full name of the JMX
6757
* specification implemented by this product.
@@ -122,18 +112,6 @@ private JmxProperties() {
122112
public static final Logger MBEANSERVER_LOGGER =
123113
System.getLogger(MBEANSERVER_LOGGER_NAME);
124114

125-
/**
126-
* Logger name for MLet service information.
127-
*/
128-
public static final String MLET_LOGGER_NAME =
129-
"javax.management.mlet";
130-
131-
/**
132-
* Logger for MLet service information.
133-
*/
134-
public static final Logger MLET_LOGGER =
135-
System.getLogger(MLET_LOGGER_NAME);
136-
137115
/**
138116
* Logger name for Monitor information.
139117
*/

src/java.management/share/classes/com/sun/jmx/defaults/ServiceName.java

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -44,14 +44,6 @@ private ServiceName() {
4444
public static final String DELEGATE =
4545
"JMImplementation:type=MBeanServerDelegate" ;
4646

47-
/**
48-
* The default key properties for registering the class loader of the
49-
* MLet service.
50-
* <BR>
51-
* The value is <CODE>type=MLet</CODE>.
52-
*/
53-
public static final String MLET = "type=MLet";
54-
5547
/**
5648
* The default domain.
5749
* <BR>

src/java.management/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -206,18 +206,6 @@ private Class<?> loadClass(final LoaderEntry list[],
206206
if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
207207
MBEANSERVER_LOGGER.log(Level.TRACE, "Trying loader = " + cl);
208208
}
209-
/* We used to have a special case for "instanceof
210-
MLet" here, where we invoked the method
211-
loadClass(className, null) to prevent infinite
212-
recursion. But the rule whereby the MLet only
213-
consults loaders that precede it in the CLR (via
214-
loadClassBefore) means that the recursion can't
215-
happen, and the test here caused some legitimate
216-
classloading to fail. For example, if you have
217-
dependencies C->D->E with loaders {E D C} in the
218-
CLR in that order, you would expect to be able to
219-
load C. The problem is that while resolving D, CLR
220-
delegation is disabled, so it can't find E. */
221209
return Class.forName(className, false, cl);
222210
} catch (ClassNotFoundException e) {
223211
// OK: continue with next class

src/java.management/share/classes/com/sun/jmx/remote/security/MBeanServerAccessController.java

+3-48
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -75,12 +75,11 @@
7575
* inappropriate.</p>
7676
*
7777
* <p>If there is no SecurityManager, then the access controller will refuse
78-
* to create an MBean that is a ClassLoader, which includes MLets, or to
79-
* execute the method addURL on an MBean that is an MLet. This prevents
78+
* to create an MBean that is a ClassLoader. This prevents
8079
* people from opening security holes unintentionally. Otherwise, it
8180
* would not be obvious that granting write access grants the ability to
8281
* download and execute arbitrary code in the target MBean server. Advanced
83-
* users who do want the ability to use MLets are presumably advanced enough
82+
* users who do want an MBean which is a ClassLoader are presumably advanced enough
8483
* to handle policy files and security managers.</p>
8584
*/
8685
public abstract class MBeanServerAccessController
@@ -468,7 +467,6 @@ public Object invoke(ObjectName name, String operationName,
468467
MBeanException,
469468
ReflectionException {
470469
checkWrite();
471-
checkMLetMethods(name, operationName);
472470
return getMBeanServer().invoke(name, operationName, params, signature);
473471
}
474472

@@ -620,49 +618,6 @@ private void checkClassLoader(Object object) {
620618
"manager is installed.");
621619
}
622620

623-
private void checkMLetMethods(ObjectName name, String operation)
624-
throws InstanceNotFoundException {
625-
// Check if security manager installed
626-
@SuppressWarnings("removal")
627-
SecurityManager sm = System.getSecurityManager();
628-
if (sm != null) {
629-
return;
630-
}
631-
// Check for addURL and getMBeansFromURL methods
632-
if (!operation.equals("addURL") &&
633-
!operation.equals("getMBeansFromURL")) {
634-
return;
635-
}
636-
// Check if MBean is instance of MLet
637-
if (!getMBeanServer().isInstanceOf(name,
638-
"javax.management.loading.MLet")) {
639-
return;
640-
}
641-
// Throw security exception
642-
if (operation.equals("addURL")) { // addURL
643-
throw new SecurityException("Access denied! MLet method addURL " +
644-
"cannot be invoked unless a security manager is installed.");
645-
} else { // getMBeansFromURL
646-
// Whether or not calling getMBeansFromURL is allowed is controlled
647-
// by the value of the "jmx.remote.x.mlet.allow.getMBeansFromURL"
648-
// system property. If the value of this property is true, calling
649-
// the MLet's getMBeansFromURL method is allowed. The default value
650-
// for this property is false.
651-
final String propName = "jmx.remote.x.mlet.allow.getMBeansFromURL";
652-
GetPropertyAction propAction = new GetPropertyAction(propName);
653-
@SuppressWarnings("removal")
654-
String propValue = AccessController.doPrivileged(propAction);
655-
boolean allowGetMBeansFromURL = "true".equalsIgnoreCase(propValue);
656-
if (!allowGetMBeansFromURL) {
657-
throw new SecurityException("Access denied! MLet method " +
658-
"getMBeansFromURL cannot be invoked unless a " +
659-
"security manager is installed or the system property " +
660-
"-Djmx.remote.x.mlet.allow.getMBeansFromURL=true " +
661-
"is specified.");
662-
}
663-
}
664-
}
665-
666621
//------------------
667622
// PRIVATE VARIABLES
668623
//------------------

0 commit comments

Comments
 (0)