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

JPlugin doesn't catch Error level exceptions

XMLWordPrintable

    • beta2
    • x86
    • windows_nt



      Name: rlT66838 Date: 12/07/99


      Java(TM) Plug-in: Version 1.3beta-O
      Using JRE version 1.3beta Java(TM) HotSpot Client VM

      The problem occurs at least in IE5.0 I haven't tested any other IE browsers.

      Compile and run the following code with the HTML provided.

      - If you click on "call test()," everything should be fine and the word "Done"
      should show up in the java console window.

      - Clicking on "call crash()" will cause the browser to crash.

      - Clicking on "call exception()" will display the exception that caused the
      crash in the previous step.

      ---- Java code: _-----------------------
      import java.io.*;
      import java.applet.*;
      import java.awt.*;

      import javax.swing.*;

      public class Test extends JApplet
      {
         public Test() throws IOException
         {
         }
            
         public void test()
         {
            getContentPane().setLayout( new GridBagLayout() );
            System.out.println( "done" );
         }
         
         public void crash()
         {
            setLayout( new GridBagLayout() );
         }
         
         public void exception()
         {
            try
            {
               setLayout( new GridBagLayout() );
            }
            catch( Throwable ex )
            {
               ex.printStackTrace();
            }
         }
         
         public void paint( Graphics g )
         {
            g.drawString( "Ready", getSize().width/2, getSize().height/2 );
         }
      }


      ------ HTML ---------------
      <html>
      <body>
      <object width="300" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
      codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-
      win.cab#Version=1,2,2,0" height="100" align="baseline" id="testApplet" >
      <param name="type" value="application/x-java-applet;version=1.2.2">
      <param name="scriptable" value="true">
      <param name="code" value="Test">
      </object>

      <ul>
      <li>DOM (IE5.0 only): <a href="javascript:false"
      onclick="document.getElementsByTagName('object')[0].test(); return false;">call
      test()</a></li>
      <li>DOM (IE5.0 only): <a href="javascript:false"
      onclick="document.getElementsByTagName('object')[0].crash(); return false">call
      crash()</a></li>
      <li>DOM (IE5.0 only): <a href="javascript:false"
      onclick="document.getElementsByTagName('object')[0].exception(); return
      false;">call exception()</a></li>
      <li>MSDOM: <a href="javascript:false" onclick="document.all.testApplet.test();
      return false;">call test()</a></li>
      <li>MSDOM: <a href="javascript:false" onclick="document.all.testApplet.crash();
      return false;">call crash()</a></li>
      <li>MSDOM: <a href="javascript:false" onclick="document.all.testApplet.exception
      (); return false;">call exception()</a></li>
      </ul>
      </body>
      </html>

      dmb
      (Review ID: 98299)
      ======================================================================

            jmelvin James Melvin (Inactive)
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: