8019584: javax/management/remote/mandatory/loading/MissingClassTest.java failed in nightly against jdk7u45: java.io.InvalidObjectException: Invalid notification: null
authorjbachorik
Fri, 19 Jul 2013 16:29:26 +0200
changeset 20829 61b4adb0a695
parent 20828 7d54086945dd
child 20830 bf6aed23937e
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
jdk/src/share/classes/javax/management/remote/NotificationResult.java
jdk/src/share/classes/javax/management/remote/TargetedNotification.java
jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java
--- a/jdk/src/share/classes/javax/management/remote/NotificationResult.java	Wed Jul 24 12:03:57 2013 -0700
+++ b/jdk/src/share/classes/javax/management/remote/NotificationResult.java	Fri Jul 19 16:29:26 2013 +0200
@@ -132,16 +132,17 @@
     }
 
     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());
         }
--- a/jdk/src/share/classes/javax/management/remote/TargetedNotification.java	Wed Jul 24 12:03:57 2013 -0700
+++ b/jdk/src/share/classes/javax/management/remote/TargetedNotification.java	Fri Jul 19 16:29:26 2013 +0200
@@ -132,13 +132,9 @@
 //     }
 
     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());
         }
--- a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java	Wed Jul 24 12:03:57 2013 -0700
+++ b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java	Fri Jul 19 16:29:26 2013 +0200
@@ -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