From d2b681d4557109158fbbce9db995f4146c344c97 Mon Sep 17 00:00:00 2001 From: Kevin Walls Date: Thu, 7 Nov 2024 13:10:26 +0000 Subject: [PATCH] 8343730: JMX cleanups Reviewed-by: cjplummer --- .../com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java | 2 +- .../classes/javax/management/MBeanServerDelegate.java | 2 +- .../share/classes/javax/management/Notification.java | 6 +++--- .../management/remote/JMXConnectionNotification.java | 9 ++------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java index c4837c8ea89ef..f5925a25d35e4 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java @@ -100,7 +100,7 @@ public MBeanServerDelegateImpl () { super(); delegateInfo = new MBeanInfo("javax.management.MBeanServerDelegate", - "Represents the MBean server from the management "+ + "Represents the MBean server from the management "+ "point of view.", MBeanServerDelegateImpl.attributeInfos, null, null,getNotificationInfo()); diff --git a/src/java.management/share/classes/javax/management/MBeanServerDelegate.java b/src/java.management/share/classes/javax/management/MBeanServerDelegate.java index 443e9a7a06c83..6e089f4164d50 100644 --- a/src/java.management/share/classes/javax/management/MBeanServerDelegate.java +++ b/src/java.management/share/classes/javax/management/MBeanServerDelegate.java @@ -31,7 +31,7 @@ import com.sun.jmx.mbeanserver.Util; /** - * Represents the MBean server from the management point of view. + * Represents the MBean server from the management point of view. * The MBeanServerDelegate MBean emits the MBeanServerNotifications when * an MBean is registered/unregistered in the MBean server. * diff --git a/src/java.management/share/classes/javax/management/Notification.java b/src/java.management/share/classes/javax/management/Notification.java index 80cf4b464d268..337628aeec82c 100644 --- a/src/java.management/share/classes/javax/management/Notification.java +++ b/src/java.management/share/classes/javax/management/Notification.java @@ -59,7 +59,7 @@ public class Notification extends EventObject { /** * @serialField type String The notification type. * A string expressed in a dot notation similar to Java properties. - * An example of a notification type is network.alarm.router + * An example of a notification type is com.sun.management.gc.notification * @serialField sequenceNumber long The notification sequence number. * A serial number which identify particular instance * of notification in the context of the notification source. @@ -83,7 +83,7 @@ public class Notification extends EventObject { /** * @serial The notification type. * A string expressed in a dot notation similar to Java properties. - * An example of a notification type is network.alarm.router + * An example of a notification type is com.sun.management.gc.notification */ private String type; @@ -239,7 +239,7 @@ public void setSequenceNumber(long sequenceNumber) { * @return The notification type. It's a string expressed in a dot notation * similar to Java properties. It is recommended that the notification type * should follow the reverse-domain-name convention used by Java package - * names. An example of a notification type is com.example.alarm.router. + * names. An example of a notification type is com.sun.management.gc.notification */ public String getType() { return type ; diff --git a/src/java.management/share/classes/javax/management/remote/JMXConnectionNotification.java b/src/java.management/share/classes/javax/management/remote/JMXConnectionNotification.java index 0ba100ec8b297..b7bb5a3dc8cac 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXConnectionNotification.java +++ b/src/java.management/share/classes/javax/management/remote/JMXConnectionNotification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -159,12 +159,7 @@ public JMXConnectionNotification(String type, long sequenceNumber, String message, Object userData) { - /* We don't know whether the parent class (Notification) will - throw an exception if the type or source is null, because - JMX 1.2 doesn't specify that. So we make sure it is not - null, in case it would throw the wrong exception - (e.g. IllegalArgumentException instead of - NullPointerException). Likewise for the sequence number. */ + // Do not pass null source to super, as EventObject will throw IllegalArgumentException. super((String) nonNull(type), nonNull(source), Math.max(0, sequenceNumber),