From f47e2e276c84d5693f639af9a11078cd9b7e4ac3 Mon Sep 17 00:00:00 2001 From: jbachorik Date: Tue, 12 Mar 2013 11:09:37 +0100 Subject: [PATCH] 8009034: Improve resulting notifications in JMX Summary: 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/src/share/classes/javax/management/remote/NotificationResult.java b/src/share/classes/javax/management/remote/NotificationResult.java index 50e91a5e7..cbc797550 100644 --- a/src/share/classes/javax/management/remote/NotificationResult.java +++ b/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(); } /** -- GitLab