changeset 6703:0f7896059207

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
author jbachorik
date Fri, 19 Jul 2013 16:29:26 +0200
parents 54bd9675a80b
children 447531e39bad
files src/share/classes/javax/management/remote/NotificationResult.java src/share/classes/javax/management/remote/TargetedNotification.java test/javax/management/remote/mandatory/loading/MissingClassTest.java
diffstat 3 files changed, 12 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/management/remote/NotificationResult.java	Fri Jul 19 15:32:01 2013 +0900
+++ b/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/src/share/classes/javax/management/remote/TargetedNotification.java	Fri Jul 19 15:32:01 2013 +0900
+++ b/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/test/javax/management/remote/mandatory/loading/MissingClassTest.java	Fri Jul 19 15:32:01 2013 +0900
+++ b/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