changeset 7398:363547f54176

8009034: Improve resulting notifications in JMX Summary: Disallowing access to mutable shared arrays Reviewed-by: dfuchs, mchung, skoivu
author jbachorik
date Tue, 12 Mar 2013 11:09:37 +0100
parents 711d544b2319
children 9114ea4791ec
files src/share/classes/javax/management/remote/NotificationResult.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/management/remote/NotificationResult.java	Tue Mar 12 09:34:26 2013 +0100
+++ b/src/share/classes/javax/management/remote/NotificationResult.java	Tue Mar 12 11:09:37 2013 +0100
@@ -89,7 +89,7 @@
 
         this.earliestSequenceNumber = earliestSequenceNumber;
         this.nextSequenceNumber = nextSequenceNumber;
-        this.targetedNotifications = targetedNotifications;
+        this.targetedNotifications = (targetedNotifications.length == 0 ? targetedNotifications : targetedNotifications.clone());
     }
 
     /**
@@ -122,7 +122,7 @@
      * listeners they correspond to.  This array can be empty.
      */
     public TargetedNotification[] getTargetedNotifications() {
-        return targetedNotifications;
+        return targetedNotifications.length == 0 ? targetedNotifications : targetedNotifications.clone();
     }
 
     /**