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

Netscape 7 crashes when applet updates page via Java when refresh

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • 6
    • 5.0
    • deploy
    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      java version "1.4.2_05"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2
      Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Window 2000 Server

      A DESCRIPTION OF THE PROBLEM :
      Our java applet calls JavaScript functions that update the page via DHTML. Everything works fine but intermittently the browser will crash on refresh or page unload. We removed the JSObject.call() from the applet and everything works fine.

      STEPS TO REPRODUCE THE PROBLEM:
      1. Save the html code into says, test.html file
      2. Open the test.html file with Netscape 7 or IE 5.
      3. Once loaded, keep on clicking on "refresh" button.
      4. Netscape with crashes with message "....memory XXXX could not be read..." while IE would just disappear.

      //********************Java code********************//
      //**This code has been simplified to reproduce the problem of Netscape browser crashes**//
      /*
       * 1.1 version.
       */
      import java.applet.Applet;
      import java.awt.*;
      import java.awt.event.*;
      import java.io.*;
      import java.util.*;
      import netscape.javascript.JSException;
      import netscape.javascript.JSObject;

      public class streamingAdaptor extends Applet implements Runnable {
          private Thread receiveThread=null;
          private boolean m_bStop = false;
       private JSObject window=null;
       public void init()
       {
        //Print out version number
        System.out.println("Streaming Adaptor: Version 1.1");
           //get the reference to the browser
        if( window == null )
        {
         try{
          window = netscape.javascript.JSObject.getWindow((Applet)this);
         }
         catch (Exception e){
          e.printStackTrace();
         }
        }
       }
          public void start()
          {
              if (receiveThread==null || !receiveThread.isAlive())
              {
                  receiveThread = new Thread(this);
                  m_bStop = false;
                  receiveThread.start();
              }
          }
          public void stop()
          {
              m_bStop = true;
              try
              {
                  receiveThread.join();
              }
        catch(Exception e){e.printStackTrace();}
          }
          public void run()
          {
              boolean bDisconnected = true;
              String received = null;
              while (!m_bStop)
              {
         
                  try {
           //Wait for data from the server.
                          received = readLine();
           
           try
           {
            invokeWindow(received);
           }
           catch(JSException e){e.printStackTrace();}
           catch (Exception e) {e.printStackTrace();}
                          received = null;
                  }
                  catch(IOException e)
                  {
                      System.out.print("ERROR: ");
                      System.out.println(e.getMessage());
                      bDisconnected = true;
                  }
               try
                  {
                      receiveThread.sleep(5);
                  }catch(Exception e){}
              }
          }
       
          //Read line with timeout set
          private synchronized String readLine() throws IOException
          {
        return "<gsxsd:gsresp msgid='20002' xmlns:gsxsd='urn:gsns'><data id='9' page='1'><name>GBPCAD</name><status>active</status><state>down</state><bid>23659</bid><ask>23669</ask><high>23734</high><low>23647</low><mid>2.36630</mid><pnt>4</pnt><stm>1</stm><spd>10.0000</spd><time>04:53:06</time></data></gsxsd:gsresp>";
          }
       private synchronized void invokeWindow(String xml) throws Exception, JSException
       {
        if( xml == null )
         return;
        Object[] arg = { xml };
        if (!m_bStop && this.window != null)
         this.window.call("doStreaming", arg);
       }
      }

      ///*****************HTML code***************************//

      <HTML>
      <HEAD>
      <TITLE>Data Streaming...</TITLE>
      <meta HTTP-EQUIV="pragma" CONTENT="no-cache">
      <meta HTTP-EQUIV="expires" CONTENT="-1441">
      <SCRIPT language="JavaScript">
      <!-- Begin
       var nRowCnt;
       var nAliveMsgID="07001";
       var sRowIDPrefix = "row";
       nRowCnt = 0;

      //this is the function called from Java
      function doStreaming(data) {
       window.status=data;
      }

      // End -->
      </SCRIPT>
      </HEAD>
      <BODY>


      <APPLET CODE="streamingAdaptor.class" NAME="receiverApplet" MAYSCRIPT WIDTH='0' HEIGHT='0'>
      </APPLET>


      <FORM name="form1">
       <table id="myTable" border="0" cellspacing="0" width="100%">
        <tbody>
         <!--<tr id='22' bgcolor="#CCCCFF" style="font-family: Verdana, Tahoma, Arial; font-size: x-small">
          <td id="row0_0">row1_column1</td><td>row1_column2</td>
         </tr>-->
        </tbody>
       </table>
      </FORM>
      </BODY>
      </HTML>

      REPRODUCIBILITY :
      This bug can be reproduced always.
      ###@###.### 2005-03-02 21:56:37 GMT

            mleisunw Mike Lei (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: