# HG changeset patch
# User jbachorik
# Date 1374244166 -7200
#      Fri Jul 19 16:29:26 2013 +0200
# Node ID 42cdf6988c2b81b322bf89778ddeb47265cd3bba
# Parent  a8132d72370c1f2467c9bb966d9355b387c35039
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

diff -r a8132d72370c -r 42cdf6988c2b src/share/classes/javax/management/remote/NotificationResult.java
--- openjdk/jdk/src/share/classes/javax/management/remote/NotificationResult.java	Mon Jul 15 16:00:57 2013 +0100
+++ openjdk/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());
         }
diff -r a8132d72370c -r 42cdf6988c2b src/share/classes/javax/management/remote/TargetedNotification.java
--- openjdk/jdk/src/share/classes/javax/management/remote/TargetedNotification.java	Mon Jul 15 16:00:57 2013 +0100
+++ openjdk/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());
         }
diff -r a8132d72370c -r 42cdf6988c2b test/javax/management/remote/mandatory/loading/MissingClassTest.java
--- openjdk/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java	Mon Jul 15 16:00:57 2013 +0100
+++ openjdk/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
