This patch makes the Notification and MBeanFeature/AttributeInfo
classes serialization compatible with Sun's JDK.

Changelog:

2007-04-06  Andrew John Hughes  <[EMAIL PROTECTED]>

        * javax/management/MBeanAttributeInfo.java:
        (serialVersionUID):  Added.
        * javax/management/MBeanFeatureInfo.java:
        (writeObject(ObjectOutputStream)): Added for
        later 1.6 support.
        * javax/management/Notification.java:
        (serialVersionUID): Added.
        (Notification(String,Object,long,long)): Make
        default message the empty string not null.
        (Notification(String,Object,long,long,String)):
        Set source explicitly.
        (writeObject(ObjectOutputStream)): Added to match
        Sun

-- 
Andrew :-)

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
Index: javax/management/MBeanAttributeInfo.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/management/MBeanAttributeInfo.java,v
retrieving revision 1.4
diff -u -3 -p -u -r1.4 MBeanAttributeInfo.java
--- javax/management/MBeanAttributeInfo.java	11 Dec 2006 01:54:39 -0000	1.4
+++ javax/management/MBeanAttributeInfo.java	6 Apr 2007 20:57:49 -0000
@@ -55,6 +55,11 @@ public class MBeanAttributeInfo
 {
 
   /**
+   * Compatible with JDK 1.6
+   */
+  private static final long serialVersionUID = 8644704819898565848L;
+
+  /**
    * The type of the attribute.
    *
    * @serial the attribute type.
Index: javax/management/MBeanFeatureInfo.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/management/MBeanFeatureInfo.java,v
retrieving revision 1.5
diff -u -3 -p -u -r1.5 MBeanFeatureInfo.java
--- javax/management/MBeanFeatureInfo.java	5 Aug 2006 12:25:51 -0000	1.5
+++ javax/management/MBeanFeatureInfo.java	6 Apr 2007 20:57:49 -0000
@@ -37,6 +37,8 @@ exception statement from your version. *
 
 package javax.management;
 
+import java.io.IOException;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
 
 /**
@@ -183,4 +185,17 @@ public class MBeanFeatureInfo
     return string;
   }
 
+  /**
+   * Serialize the [EMAIL PROTECTED] MBeanFeatureInfo}.
+   *
+   * @param out the output stream to write to.
+   * @throws IOException if an I/O error occurs.
+   */
+  private void writeObject(ObjectOutputStream out)
+    throws IOException
+  {
+    out.defaultWriteObject();
+    /* FIXME: Handle extra 1.6 descriptor stuff */
+  }
+
 }
Index: javax/management/Notification.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/management/Notification.java,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 Notification.java
--- javax/management/Notification.java	16 Jul 2006 14:35:38 -0000	1.1
+++ javax/management/Notification.java	6 Apr 2007 20:57:49 -0000
@@ -37,6 +37,9 @@ exception statement from your version. *
 
 package javax.management;
 
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
 import java.util.Date;
 import java.util.EventObject;
 
@@ -66,6 +69,11 @@ public class Notification
 {
 
   /**
+   * Compatible with JDK 1.6
+   */
+  private static final long serialVersionUID = -7516092053498031989L;
+
+  /**
    * The notification message.
    *
    * @serial the notification message.
@@ -141,7 +149,7 @@ public class Notification
   public Notification(String type, Object source, long sequenceNumber,
 		      long timeStamp)
   {
-    this(type, source, sequenceNumber, timeStamp, null);
+    this(type, source, sequenceNumber, timeStamp, "");
   }
 
   /**
@@ -159,6 +167,7 @@ public class Notification
   {
     super(source);
     this.type = type;
+    this.source = source;
     this.sequenceNumber = sequenceNumber;
     this.timeStamp = timeStamp;
     this.message = message;
@@ -310,5 +319,17 @@ public class Notification
       + "]";
   }
 
+  /**
+   * Serialize the [EMAIL PROTECTED] Notification}.
+   *
+   * @param out the output stream to write to.
+   * @throws IOException if an I/O error occurs.
+   */
+  private void writeObject(ObjectOutputStream out)
+    throws IOException
+  {
+    out.defaultWriteObject();
+  }
+
 }
 

Attachment: signature.asc
Description: Digital signature

Reply via email to