This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 315584 - ClassCastException in org.eclipse.wst.html.core.internal.htmlcss.HTMLDocumentAdapter
Summary: ClassCastException in org.eclipse.wst.html.core.internal.htmlcss.HTMLDocument...
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.2.3   Edit
Assignee: Nitin Dahyabhai CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
: 306567 317622 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-03 09:37 EDT by Raghunathan Srinivasan CLA
Modified: 2010-12-03 14:34 EST (History)
3 users (show)

See Also:
nsand.dev: review+


Attachments
proposed patch, might need to be scaled back (4.49 KB, patch)
2010-07-02 15:28 EDT, Nitin Dahyabhai CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raghunathan Srinivasan CLA 2010-06-03 09:37:23 EDT
eclipse.buildId=I20100527-1200
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86


Error
Tue Jun 01 21:37:45 PDT 2010
A structured model client, org.eclipse.wst.html.core.internal.htmlcss.HTMLDocumentAdapter@d32527 threw following exception during adapter notification (ADD )

java.lang.ClassCastException: java.lang.String cannot be cast to org.w3c.dom.Node
at org.eclipse.wst.html.core.internal.htmlcss.HTMLDocumentAdapter.notifyChanged(HTMLDocumentAdapter.java:255)
at org.eclipse.wst.sse.core.internal.provisional.AbstractNotifier.notify(AbstractNotifier.java:202)
at org.eclipse.wst.xml.core.internal.document.AttrImpl.setName(AttrImpl.java:672)
at org.eclipse.wst.xml.core.internal.document.XMLModelParser.changeAttrName(XMLModelParser.java:159)
at org.eclipse.wst.xml.core.internal.document.XMLModelParser.changeRegion(XMLModelParser.java:326)
at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.regionChanged(DOMModelImpl.java:725)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:542)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1180)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1964)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2419)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2404)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$2(JobSafeStructuredDocument.java:1)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$3.run(JobSafeStructuredDocument.java:141)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:149)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replaceText(JobSafeStructuredDocument.java:144)
at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replace(BasicStructuredDocument.java:2364)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$0(JobSafeStructuredDocument.java:1)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$1.run(JobSafeStructuredDocument.java:103)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:149)
at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replace(JobSafeStructuredDocument.java:106)
at org.eclipse.jface.text.projection.ProjectionTextStore.replace(ProjectionTextStore.java:111)
at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1184)
at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1210)
at org.eclipse.jface.text.projection.ProjectionDocument.replace(ProjectionDocument.java:629)
at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:248)
at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7168)
at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7975)
at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456)
at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5928)
at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5958)
at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5652)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4268)
at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4160)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2459)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Comment 1 Raghunathan Srinivasan CLA 2010-06-03 09:43:56 EDT
I don't have steps to repro. this exception. Found it while testing JSF functionality.
Comment 2 Nitin Dahyabhai CLA 2010-06-03 10:35:45 EDT
In this case the stack trace is good enough.  The changes for bug 236311 added the attribute's name, as a string, as a value during adapter notification.  This is the first time in an XML-based DOM where the value is neither null nor itself a DOM Node.
Comment 3 Raghunathan Srinivasan CLA 2010-06-03 13:57:47 EDT
*** Bug 306567 has been marked as a duplicate of this bug. ***
Comment 4 Nitin Dahyabhai CLA 2010-06-23 10:27:44 EDT
*** Bug 317622 has been marked as a duplicate of this bug. ***
Comment 5 Nitin Dahyabhai CLA 2010-07-02 15:28:42 EDT
Created attachment 173326 [details]
proposed patch, might need to be scaled back
Comment 6 Nick Sandonato CLA 2010-07-06 11:17:42 EDT
Patch looks OK to me.
Comment 7 Nitin Dahyabhai CLA 2010-07-12 10:17:06 EDT
Untargeting pending being able to write a JUnit or having a reproducable scenario.  I can't figure out how this could actually happen--AttrImpl can only call notify on an Element and yet the adapter is only installed on a Document.
Comment 8 Nick Sandonato CLA 2010-10-19 18:01:23 EDT
Changes released to 3_2_Maintenance and HEAD.
Comment 9 Raghunathan Srinivasan CLA 2010-12-02 14:58:50 EST
Similar exception in WTP 3.3 build, http://build.eclipse.org/webtools/committers/wtp-R3.3.0-I/20101202074646/I-3.3.0-20101202074646/ 

Steps:
1) Create a JSF 2.0 DWP project.
2) Create a XHTML page
3) Add JSF tag, h:outputText
4) Set the Value attribute, value="foo"
Note exception in log file.


eclipse.buildId=I20101028-1441
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86


Error
Thu Dec 02 11:37:35 PST 2010
A structured model client, org.eclipse.wst.html.core.internal.htmlcss.HTMLDocumentAdapter@1ed022a threw following exception during adapter notification (CHANGE )

java.lang.ClassCastException: org.eclipse.wst.html.core.internal.document.ElementStyleImpl cannot be cast to org.w3c.dom.Attr
	at org.eclipse.wst.html.core.internal.htmlcss.HTMLDocumentAdapter.notifyChanged(HTMLDocumentAdapter.java:306)
	at org.eclipse.wst.sse.core.internal.provisional.AbstractNotifier.notify(AbstractNotifier.java:202)
	at org.eclipse.wst.xml.core.internal.document.XMLModelNotifierImpl.notify(XMLModelNotifierImpl.java:238)
	at org.eclipse.wst.xml.core.internal.document.XMLModelNotifierImpl.notifyDeferred(XMLModelNotifierImpl.java:340)
	at org.eclipse.wst.xml.core.internal.document.XMLModelNotifierImpl.endChanging(XMLModelNotifierImpl.java:178)
	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.changedModel(DOMModelImpl.java:163)
	at org.eclipse.wst.sse.core.internal.model.AbstractStructuredModel$DocumentToModelNotifier.regionChanged(AbstractStructuredModel.java:164)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:542)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1181)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1964)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2419)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2404)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$2(JobSafeStructuredDocument.java:1)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$3.run(JobSafeStructuredDocument.java:141)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:149)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replaceText(JobSafeStructuredDocument.java:144)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replace(BasicStructuredDocument.java:2364)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$0(JobSafeStructuredDocument.java:1)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$1.run(JobSafeStructuredDocument.java:103)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:149)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replace(JobSafeStructuredDocument.java:106)
	at org.eclipse.jface.text.projection.ProjectionTextStore.replace(ProjectionTextStore.java:111)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1184)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1210)
	at org.eclipse.jface.text.projection.ProjectionDocument.replace(ProjectionDocument.java:629)
	at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:248)
	at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7172)
	at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7986)
	at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2458)
	at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5932)
	at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5962)
	at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5656)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4273)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4165)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4891)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2460)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3673)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:621)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:576)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1409)
Comment 10 Nick Sandonato CLA 2010-12-02 17:17:28 EST
(In reply to comment #9)
> Similar exception in WTP 3.3 build,
> http://build.eclipse.org/webtools/committers/wtp-R3.3.0-I/20101202074646/I-3.3.0-20101202074646/ 
> 
> Steps:
> 1) Create a JSF 2.0 DWP project.
> 2) Create a XHTML page
> 3) Add JSF tag, h:outputText
> 4) Set the Value attribute, value="foo"
> Note exception in log file.

Thanks, Raghu. Rakesh seems to already have a fix for this lined up: Bug 331084.
Comment 11 Raghunathan Srinivasan CLA 2010-12-02 17:39:12 EST
(In reply to comment #10)
> Thanks, Raghu. Rakesh seems to already have a fix for this lined up: Bug
> 331084.
Great. Thanks.
Comment 12 Nick Sandonato CLA 2010-12-03 14:34:24 EST
I released the changes from Bug 331084 that should resolve this.