diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java index ba071411608..58ccfb45280 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java @@ -68,9 +68,9 @@ public class ServerNotifForwarder { this.notifBuffer = notifBuffer; this.connectionId = connectionId; connectionTimeout = EnvHelp.getServerConnectionTimeout(env); - checkNotificationEmission = EnvHelp.computeBooleanFromString( - env, - "jmx.remote.x.check.notification.emission",false); + + String stringBoolean = (String) env.get("jmx.remote.x.check.notification.emission"); + checkNotificationEmission = EnvHelp.computeBooleanFromString( stringBoolean ); notificationAccessController = EnvHelp.getNotificationAccessController(env); } diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java index e61d9d09d60..b8bf9d37a0f 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java @@ -665,97 +665,57 @@ public class EnvHelp { * Computes a boolean value from a string value retrieved from a * property in the given map. * - * @param env the environment map. - * @param prop the name of the property in the environment map whose - * returned string value must be converted into a boolean value. - * @param systemProperty if true, consult a system property of the - * same name if there is no entry in the environment map. + * @param stringBoolean the string value that must be converted + * into a boolean value. * * @return * * - * @throws IllegalArgumentException if {@code env} is {@code null} or - * {@code env.get(prop)} is not {@code null} and + * @throws IllegalArgumentException if * {@code ((String)env.get(prop)).equalsIgnoreCase("false")} and * {@code ((String)env.get(prop)).equalsIgnoreCase("true")} are * {@code false}. - * @throws ClassCastException if {@code env.get(prop)} cannot be cast - * to {@code String}. */ - public static boolean computeBooleanFromString( - Map env, String prop, boolean systemProperty) { - - if (env == null) - throw new IllegalArgumentException("env map cannot be null"); - + public static boolean computeBooleanFromString(String stringBoolean) { // returns a default value of 'false' if no property is found... - return computeBooleanFromString(env,prop,systemProperty,false); + return computeBooleanFromString(stringBoolean,false); } /** * Computes a boolean value from a string value retrieved from a * property in the given map. * - * @param env the environment map. - * @param prop the name of the property in the environment map whose - * returned string value must be converted into a boolean value. - * @param systemProperty if true, consult a system property of the - * same name if there is no entry in the environment map. + * @param stringBoolean the string value that must be converted + * into a boolean value. * @param defaultValue a default value to return in case no property * was defined. * * @return * * - * @throws IllegalArgumentException if {@code env} is {@code null} or - * {@code env.get(prop)} is not {@code null} and + * @throws IllegalArgumentException if * {@code ((String)env.get(prop)).equalsIgnoreCase("false")} and * {@code ((String)env.get(prop)).equalsIgnoreCase("true")} are * {@code false}. - * @throws ClassCastException if {@code env.get(prop)} cannot be cast - * to {@code String}. */ - public static boolean computeBooleanFromString( - Map env, String prop, - boolean systemProperty, boolean defaultValue) { - - if (env == null) - throw new IllegalArgumentException("env map cannot be null"); - - String stringBoolean = (String) env.get(prop); - if (stringBoolean == null && systemProperty) { - stringBoolean = - AccessController.doPrivileged(new GetPropertyAction(prop)); - } - + public static boolean computeBooleanFromString( String stringBoolean, boolean defaultValue) { if (stringBoolean == null) return defaultValue; else if (stringBoolean.equalsIgnoreCase("true")) @@ -763,8 +723,8 @@ public class EnvHelp { else if (stringBoolean.equalsIgnoreCase("false")) return false; else - throw new IllegalArgumentException(prop + - " must be \"true\" or \"false\" instead of \"" + + throw new IllegalArgumentException( + "Property value must be \"true\" or \"false\" instead of \"" + stringBoolean + "\""); } diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java index f5359f9b12c..f6d17d6cc08 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java @@ -277,9 +277,9 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable // Check for secure RMIServer stub if the corresponding // client-side environment property is set to "true". // - boolean checkStub = EnvHelp.computeBooleanFromString( - usemap, - "jmx.remote.x.check.stub",false); + String stringBoolean = (String) usemap.get("jmx.remote.x.check.stub"); + boolean checkStub = EnvHelp.computeBooleanFromString(stringBoolean); + if (checkStub) checkStub(stub, rmiServerImplStubClass); // Connect IIOP Stub if needed. diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java index 909b9cb0d47..da92f49f70b 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java @@ -412,9 +412,8 @@ public class RMIConnectorServer extends JMXConnectorServer { if (tracing) logger.trace("start", "Using external directory: " + jndiUrl); - final boolean rebind = EnvHelp.computeBooleanFromString( - attributes, - JNDI_REBIND_ATTRIBUTE,false); + String stringBoolean = (String) attributes.get(JNDI_REBIND_ATTRIBUTE); + final boolean rebind = EnvHelp.computeBooleanFromString( stringBoolean ); if (tracing) logger.trace("start", JNDI_REBIND_ATTRIBUTE + "=" + rebind);