Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4113009

java.beans.beancontext.BeanContextMembershipEvent fails to be serialized.

    XMLWordPrintable

Details

    • 1.2beta4
    • sparc
    • solaris_2.5
    • Verified

    Description



      Name: avC70361 Date: 02/18/98



        The java.beans.beancontext.BeanContextMembershipEvent fails to be serialized
      despite of implementing java.io.Serializable interface. While writing an
      instance of the class java.io.NotSerializableException for class
      java.util.Arrays$ArrayList is thrown.
        Here is the test demonstrating the bug.
      ---------BeanContextMembershipEventTest.java------
      import java.beans.beancontext.*;
      import java.io.*;

      public class BeanContextMembershipEventTest {

        public static void main(String args[]) {
          BeanContextMembershipEvent event = null;

          ObjectOutputStream ostream = null;
          ByteArrayOutputStream baos = null;
          ObjectInputStream istream = null;

          try {

            event = new BeanContextMembershipEvent(new BeanContextSupport(), new Object[] {"string"});

            ostream = new ObjectOutputStream(
              baos = new ByteArrayOutputStream()
            );

            ostream.writeObject(event);
            ostream.flush();

          } catch(Exception e) {
            System.out.println("Unexpected exception while writing object : " + e);
            System.exit(1);
          }

          System.out.println("OK");

        }

      }
      ------The test output-------
      > java BeanContextMembershipEventTest
      Unexpected exception while writing object : java.io.NotSerializableException: java.util.Arrays$ArrayList

      ======================================================================

      Attachments

        Activity

          People

            lcablesunw Larry Cable (Inactive)
            ovlasov Oleksandr Vlasov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: