From 5016132291b8cb94c37ffb9397282927df87a3c5 Mon Sep 17 00:00:00 2001 From: Kevin Walls Date: Mon, 11 Nov 2024 12:26:38 +0000 Subject: [PATCH] 8343838: Test EmptyDomainNotificationTest.java fails with ListenerNotFoundException Reviewed-by: dholmes --- .../jmx/remote/internal/ServerNotifForwarder.java | 14 +++++++++++++- test/jdk/ProblemList.txt | 2 -- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java b/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java index f15c416f296..fb24055cc8f 100644 --- a/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java +++ b/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java @@ -162,10 +162,22 @@ public class ServerNotifForwarder { connectionId, name, getSubject()); } + // 6238731: set the default domain if no domain is set. + ObjectName nn = name; + if (name.getDomain() == null || name.getDomain().isEmpty()) { + try { + nn = ObjectName.getInstance(mbeanServer.getDefaultDomain(), + name.getKeyPropertyList()); + } catch (MalformedObjectNameException mfoe) { + // impossible, but... + throw new IOException(mfoe.getMessage(), mfoe); + } + } + Exception re = null; for (int i = 0 ; i < listenerIDs.length ; i++) { try { - removeNotificationListener(name, listenerIDs[i]); + removeNotificationListener(nn, listenerIDs[i]); } catch (Exception e) { // Give back the first exception // diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 4b483a4b076..1ae9623ef14 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -563,8 +563,6 @@ javax/management/monitor/DerivedGaugeMonitorTest.java 8042211 generic- javax/management/remote/mandatory/connection/BrokenConnectionTest.java 8262312 linux-all -javax/management/remote/mandatory/notif/EmptyDomainNotificationTest.java 8343838 generic-all - ############################################################################ # jdk_net