diff --git a/src/share/classes/javax/management/MBeanNotificationInfo.java b/src/share/classes/javax/management/MBeanNotificationInfo.java index dfa4ab1f8ff9451cebaae51956150c0469714392..e3b4aba12526d8dd225948fcf6c493fb62728532 100644 --- a/src/share/classes/javax/management/MBeanNotificationInfo.java +++ b/src/share/classes/javax/management/MBeanNotificationInfo.java @@ -210,11 +210,6 @@ public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable ObjectInputStream.GetField gf = ois.readFields(); String[] t = (String[])gf.get("types", null); - if (t == null) { - throw new InvalidObjectException("Trying to deserialize an invalid " + - "instance of " + MBeanNotificationInfo.class + - "[types=null]"); - } - types = t.length == 0 ? t : t.clone(); + types = (t != null && t.length != 0) ? t.clone() : NO_TYPES; } } diff --git a/src/share/classes/javax/management/remote/NotificationResult.java b/src/share/classes/javax/management/remote/NotificationResult.java index 9e7cfaac31db83ffa8cf6ccc6c348cfcf3536daa..ff3978d99eb7e7e20e344f02611f656e8607c1f5 100644 --- a/src/share/classes/javax/management/remote/NotificationResult.java +++ b/src/share/classes/javax/management/remote/NotificationResult.java @@ -132,16 +132,17 @@ public class NotificationResult implements Serializable { } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { - ObjectInputStream.GetField gf = ois.readFields(); - TargetedNotification[] tNotifs = (TargetedNotification[])gf.get("targetedNotifications", null); - long snStart = gf.get("earliestSequenceNumber", -1L); - long snNext = gf.get("nextSequenceNumber", -1L); + ois.defaultReadObject(); try { - validate(tNotifs, snStart, snNext); + validate( + this.targetedNotifications, + this.earliestSequenceNumber, + this.nextSequenceNumber + ); - this.targetedNotifications = tNotifs.length == 0 ? tNotifs : tNotifs.clone(); - this.earliestSequenceNumber = snStart; - this.nextSequenceNumber = snNext; + this.targetedNotifications = this.targetedNotifications.length == 0 ? + this.targetedNotifications : + this.targetedNotifications.clone(); } catch (IllegalArgumentException e) { throw new InvalidObjectException(e.getMessage()); } diff --git a/src/share/classes/javax/management/remote/TargetedNotification.java b/src/share/classes/javax/management/remote/TargetedNotification.java index 03aa0ca62359d88a3225e8304ac2f13b565432aa..cc3d0dcc664dd5f45d2e66d9cfb8d216ea3fdd20 100644 --- a/src/share/classes/javax/management/remote/TargetedNotification.java +++ b/src/share/classes/javax/management/remote/TargetedNotification.java @@ -132,13 +132,9 @@ public class TargetedNotification implements Serializable { // } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { - ObjectInputStream.GetField gf = ois.readFields(); - Notification notification = (Notification)gf.get("notif", null); - Integer listenerId = (Integer)gf.get("id", null); + ois.defaultReadObject(); try { - validate(notification, listenerId); - this.notif = notification; - this.id = listenerId; + validate(this.notif, this.id); } catch (IllegalArgumentException e) { throw new InvalidObjectException(e.getMessage()); } diff --git a/test/javax/management/remote/mandatory/loading/MissingClassTest.java b/test/javax/management/remote/mandatory/loading/MissingClassTest.java index e70d0adfe6e62da89ffe2786833b0acbe03acc1d..98eead895bf0deb13789f02d84fe46fcf6225631 100644 --- a/test/javax/management/remote/mandatory/loading/MissingClassTest.java +++ b/test/javax/management/remote/mandatory/loading/MissingClassTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4915825 4921009 4934965 4977469 + * @bug 4915825 4921009 4934965 4977469 8019584 * @summary Tests behavior when client or server gets object of unknown class * @author Eamonn McManus * @run clean MissingClassTest SingleClassLoader