FULL PRODUCT VERSION : java version "1.6.0_10" Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows XP [Version 5.1.2600] A DESCRIPTION OF THE PROBLEM : import java.lang.reflect.*; import org.w3c.dom.*; import org.w3c.dom.html.*; /** Simple applet which fails to get an HTMLTextAreaElement from DOM */ public class DOMDump extends java.applet.Applet { private HTMLTextAreaElement htae; public void start() { try { Class c = Class.forName("com.sun.java.browser.plugin2.DOM"); Method m = c.getMethod("getDocument", new Class[] { java.applet.Applet.class }); HTMLDocument doc = (HTMLDocument) m.invoke(null, new Object[] { this }); htae = (HTMLTextAreaElement)doc.getElementById("textareaid"); htae.setValue("This is a textarea"); } catch (Exception e) { e.printStackTrace(); System.out.println("Error with Java Plug-In"); } } } STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Compile the applet source given below. Then embed it in the following html document: <html> <head> <title> DOM Dump test applet </title> </head> <body> <form method="post"> <textarea name="textbox" id="textareaid" rows="25" cols="18"></textarea> </form> <applet code=DOMDump.class archive="DOMDump.jar" width=10 height=10 mayscript> </applet> </body> </html> EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The text "This is a textarea" should show up in the textarea of the html page as soon as the applet starts. ACTUAL - No text shows up. ERROR MESSAGES/STACK TRACES THAT OCCUR : java.lang.ClassCastException: sun.plugin.dom.html.HTMLElement cannot be cast to org.w3c.dom.html.HTMLTextAreaElement at DOMDump.start(DOMDump.java:19) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Error with Java Plug-In REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.lang.reflect.*; import org.w3c.dom.*; import org.w3c.dom.html.*; /** Simple applet which fails to get an HTMLTextAreaElement from DOM */ public class DOMDump extends java.applet.Applet { private HTMLTextAreaElement htae; public void start() { try { Class c = Class.forName("com.sun.java.browser.plugin2.DOM"); Method m = c.getMethod("getDocument", new Class[] { java.applet.Applet.class }); HTMLDocument doc = (HTMLDocument) m.invoke(null, new Object[] { this }); htae = (HTMLTextAreaElement)doc.getElementById("textareaid"); htae.setValue("This is a textarea"); } catch (Exception e) { e.printStackTrace(); System.out.println("Error with Java Plug-In"); } } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Could not find one. Release Regression From : 6 The above release value was the last known release where this bug was not reproducible. Since then there has been a regression.
|