8009034: Improve resulting notifications in JMX

Disallowing access to mutable shared arrays

Reviewed-by: dfuchs, mchung, skoivu
This commit is contained in:
Jaroslav Bachorik 2013-03-12 11:09:37 +01:00
parent c5d1f48f54
commit 9e0c698e00

View File

@ -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();
}
/**