diff --git a/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java b/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java index a64db45c22f03..54d1f45c6ce6d 100644 --- a/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java +++ b/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -262,21 +262,11 @@ public static Throwable getCause(Throwable t) { public static int getNotifBufferSize(Map env) { int defaultQueueSize = 1000; // default value - // keep it for the compatibility for the fix: - // 6174229: Environment parameter should be notification.buffer.size - // instead of buffer.size - final String oldP = "jmx.remote.x.buffer.size"; - // the default value re-specified in the system try { String s = System.getProperty(BUFFER_SIZE_PROPERTY); if (s != null) { defaultQueueSize = Integer.parseInt(s); - } else { // try the old one - s = System.getProperty(oldP); - if (s != null) { - defaultQueueSize = Integer.parseInt(s); - } } } catch (RuntimeException e) { logger.warning("getNotifBufferSize", @@ -292,10 +282,6 @@ public static int getNotifBufferSize(Map env) { queueSize = (int)EnvHelp.getIntegerAttribute(env,BUFFER_SIZE_PROPERTY, defaultQueueSize,0, Integer.MAX_VALUE); - } else { // try the old one - queueSize = (int)EnvHelp.getIntegerAttribute(env,oldP, - defaultQueueSize,0, - Integer.MAX_VALUE); } } catch (RuntimeException e) { logger.warning("getNotifBufferSize", diff --git a/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java b/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java index 94a0690428239..8f4fe0a24f0da 100644 --- a/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java +++ b/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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,7 +23,7 @@ /* * @test NotifBufferSizePropertyNameTest - * @bug 6174229 + * @bug 6174229 8345045 * @summary Verify the property name specifying server notification buffer size. * @author Shanliang JIANG * @@ -52,35 +52,25 @@ public void handleNotification(Notification n, Object hb) { }; public static void main(String[] args) throws Exception { - System.out.println( - "Verify the property name specifying the server notification buffer size."); + System.out.println("Verify the property name specifying the server notification buffer size."); oname = new ObjectName ("Default:name=NotificationEmitter"); url = new JMXServiceURL("rmi", null, 0); Map env = new HashMap(2); - System.out.println("Test the new property name."); + System.out.println("Test the property name."); env.put("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); test(env); - System.out.println("Test the old property name."); - env.remove("jmx.remote.x.notification.buffer.size"); - env.put("jmx.remote.x.buffer.size", String.valueOf(bufferSize)); - test(env); - + // Recognition of the old, incorrect property "jmx.remote.x.buffer.size" has been dropped. + // Do not test old name is recognised, but do test it does not interfere with correct name: System.out.println("Test that the new property name overwrite the old one."); env.put("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); env.put("jmx.remote.x.buffer.size", String.valueOf(bufferSize*6)); test(env); - System.out.println("Test the old property name on system."); - System.setProperty("jmx.remote.x.buffer.size", String.valueOf(bufferSize)); - test(null); - - System.out.println( - "Test that the new property name overwrite the old one on system."); - System.setProperty("jmx.remote.x.notification.buffer.size", - String.valueOf(bufferSize)); + System.out.println("Test that the new property name overwrite the old one on system."); + System.setProperty("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); System.setProperty("jmx.remote.x.buffer.size", String.valueOf(bufferSize*6)); test(null); }