8009034: Improve resulting notifications in JMX
Summary: Disallowing access to mutable shared arrays
Reviewed-by: dfuchs, mchung, skoivu
--- 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();
}
/**