FIX: Error on Exit in IE when Using Java Serialization

ID: Q189063

The information in this article applies to:

SYMPTOMS

A complex serialization scheme when used from Internet Explorer causes Internet Explorer to stop when exiting. Internet Explorer stops with a dialog box that reports:

   Iexplore.exe - Application Error

   The instruction at "0xSomeAddr" referenced memory at "0xOthrAddr". The
   memory could not be "read".

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in the Virtual Machine for Java distributed with Internet Explorer 4.01 Service Pack 1 and later.

MORE INFORMATION

Steps to Reproduce Behavior

1. Save this Java source to a file named Test2.java:

      import java.applet.*;
      import java.awt.*;
      import java.io.*;

      // this applet builds a serialized object which has the minimum
      // required complexity to reproduce a bug in IE 4.0x

      public class test2 extends Applet

      {
         Panel panel = new Panel();
         Button load = new Button("           ");

         public void init()
         {
            add(panel);
            panel.setLayout(new FlowLayout());
            panel.add(load);
            try
            {
               serial();
            }
            catch (Exception x)
            {
               System.out.println("Exception: " + x.getMessage());
            }
         }

         private void serial() throws IOException, ClassNotFoundException
         {
            ByteArrayOutputStream biff = new ByteArrayOutputStream();
            ObjectOutputStream out = new ObjectOutputStream(biff);
            out.writeObject(new level0());
            out.flush();
            out.close();
            byte[] temp = biff.toByteArray();
            ByteArrayInputStream joe = new ByteArrayInputStream(temp);
            ObjectInputStream in = new ObjectInputStream(joe);
            level0 obj = (level0)in.readObject();
            in.close();
            load.setLabel(obj.name);
         }
      }

      abstract class base
      implements java.io.Serializable
      {}

      class level0 extends base
      implements java.io.Serializable
      {
         level1 x = new level1();
         public String name = "Can exit";
      }

      class level1
      implements java.io.Serializable
      {
         level2 x = new level2();
      }

      class level2
      implements java.io.Serializable
      {
         level3 x = new level3();
      }

      class level3
      implements java.io.Serializable
      {}

2. Compile the file.

3. Run the class "test2" as an applet in Internet Explorer 4.0x.

4. When you see the button with the label "Can exit," exit Internet Explorer.

5. The dialog box will appear telling you that IExplore.exe has an error.

NOTE: When running Internet Explorer 4.0x with Active Desktop installed, this bug may cause either instability in the desktop, or your machine may hang or stop on exit (logoff, restart, or shutdown).

Additional query words: java serialization

Keywords          : IOPkg JVM 
Version           : WINDOWS:2.0,2.01,4.0,4.01
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: November 11, 1998