8009034: Improve resulting notifications in JMX
authorjbachorik
Tue, 12 Mar 2013 11:09:37 +0100
changeset 18189 ef33730f6b2b
parent 18188 48e73ecb2461
child 18190 e45d26861c25
8009034: Improve resulting notifications in JMX Summary: Disallowing access to mutable shared arrays Reviewed-by: dfuchs, mchung, skoivu
jdk/src/share/classes/javax/management/remote/NotificationResult.java
--- a/jdk/src/share/classes/javax/management/remote/NotificationResult.java	Tue Mar 12 09:34:26 2013 +0100
+++ b/jdk/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();
     }
 
     /**