From 9e0c698e0031fb22e0e183084004006896bdb09d Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Tue, 12 Mar 2013 11:09:37 +0100 Subject: [PATCH] 8009034: Improve resulting notifications in JMX Disallowing access to mutable shared arrays Reviewed-by: dfuchs, mchung, skoivu --- .../classes/javax/management/remote/NotificationResult.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/javax/management/remote/NotificationResult.java b/jdk/src/share/classes/javax/management/remote/NotificationResult.java index 50e91a5e769..cbc79755099 100644 --- a/jdk/src/share/classes/javax/management/remote/NotificationResult.java +++ b/jdk/src/share/classes/javax/management/remote/NotificationResult.java @@ -89,7 +89,7 @@ public class NotificationResult implements Serializable { this.earliestSequenceNumber = earliestSequenceNumber; this.nextSequenceNumber = nextSequenceNumber; - this.targetedNotifications = targetedNotifications; + this.targetedNotifications = (targetedNotifications.length == 0 ? targetedNotifications : targetedNotifications.clone()); } /** @@ -122,7 +122,7 @@ public class NotificationResult implements Serializable { * listeners they correspond to. This array can be empty. */ public TargetedNotification[] getTargetedNotifications() { - return targetedNotifications; + return targetedNotifications.length == 0 ? targetedNotifications : targetedNotifications.clone(); } /**