8019584: javax/management/remote/mandatory/loading/MissingClassTest.java failed in nightly against jdk7u45: java.io.InvalidObjectException: Invalid notification: null

Reviewed-by: mchung, sjiang, dfuchs, ahgross
This commit is contained in:
Jaroslav Bachorik 2013-07-19 16:29:26 +02:00
parent 99860de3cd
commit eef8299094
3 changed files with 12 additions and 15 deletions

View File

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

View File

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

View File

@ -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