Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316993 - [content model] DOMException when refreshing
Summary: [content model] DOMException when refreshing
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.2.2   Edit
Assignee: Rakesh CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-15 21:26 EDT by Steffen Pingel CLA
Modified: 2010-08-16 16:28 EDT (History)
1 user (show)

See Also:
nsand.dev: review+


Attachments
sample file: /vote/src/main/webapp/WEB-INF/layouts/default.jspx (3.22 KB, text/plain)
2010-06-15 21:27 EDT, Steffen Pingel CLA
no flags Details
Patch (2.51 KB, patch)
2010-06-24 06:36 EDT, Rakesh CLA
no flags Details | Diff
Patch (2.81 KB, patch)
2010-07-01 06:06 EDT, Rakesh CLA
no flags Details | Diff
patch (4.67 KB, patch)
2010-07-02 03:22 EDT, Rakesh CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2010-06-15 21:26:25 EDT
When I generate the the Spring Roo vote example and refresh the project several of the exceptions below are logged:

org.w3c.dom.DOMException
	at org.eclipse.wst.xml.core.internal.document.ElementImpl.insertBefore(ElementImpl.java:715)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertNode(XMLModelParser.java:1351)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertNode(XMLModelParser.java:1325)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertCDATASection(XMLModelParser.java:913)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertStructuredDocumentRegion(XMLModelParser.java:1520)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.replaceStructuredDocumentRegions(XMLModelParser.java:2345)
	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.internalSetNewDocument(DOMModelImpl.java:595)
	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.setStructuredDocument(DOMModelImpl.java:870)
	at org.eclipse.wst.sse.core.internal.model.AbstractModelLoader.createModel(AbstractModelLoader.java:127)
	at org.eclipse.wst.sse.core.internal.FileBufferModelManager.getModel(FileBufferModelManager.java:719)
	at org.eclipse.wst.sse.core.internal.FileBufferModelManager.getModel(FileBufferModelManager.java:679)
	at org.eclipse.wst.sse.core.internal.model.ModelManagerImpl._doCommonGetModel(ModelManagerImpl.java:541)
	at org.eclipse.wst.sse.core.internal.model.ModelManagerImpl._commonGetModel(ModelManagerImpl.java:508)
	at org.eclipse.wst.sse.core.internal.model.ModelManagerImpl._commonGetModel(ModelManagerImpl.java:481)
	at org.eclipse.wst.sse.core.internal.model.ModelManagerImpl.getModelForRead(ModelManagerImpl.java:1410)
	at org.eclipse.wst.sse.core.internal.validate.ValidatorGroupListener.validationStarting(ValidatorGroupListener.java:72)
	at org.eclipse.wst.validation.internal.ValManager$2.run(ValManager.java:854)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.wst.validation.internal.ValManager.notifyGroupListenersStarting(ValManager.java:852)
	at org.eclipse.wst.validation.internal.ValManager.accept(ValManager.java:807)
	at org.eclipse.wst.validation.internal.ValManager.validate(ValManager.java:669)
	at org.eclipse.wst.validation.internal.ValBuilderJob$Visitor.visit(ValBuilderJob.java:321)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:68)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:48)
	at org.eclipse.wst.validation.internal.ValBuilderJob.deltaBuild(ValBuilderJob.java:211)
	at org.eclipse.wst.validation.internal.ValBuilderJob.run(ValBuilderJob.java:179)
	at org.eclipse.wst.validation.internal.ValBuilderJob.runInWorkspace(ValBuilderJob.java:126)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Steffen Pingel CLA 2010-06-15 21:27:39 EDT
Created attachment 172010 [details]
sample file: /vote/src/main/webapp/WEB-INF/layouts/default.jspx
Comment 2 Rakesh CLA 2010-06-24 06:36:34 EDT
Created attachment 172588 [details]
Patch

We should not scan CDATA when we are in ST_BLOCK_TAG_SCAN state in JSPTokenizer.I have used JFlex to create JSPTokernizer.java ,but had to do some changes manually.
Comment 3 Nick Sandonato CLA 2010-06-28 18:06:05 EDT
Hi, Rakesh. I don't think we really need to tweak the JSPTokenizer for the solution (though it does work, but you'll notice that the CDATA tag is no longer syntax highlighted).

I think the solution will actually be within the ElementImpl#insertBefore method if we could tweak the if() statement to not only exclude TEXT_NODE nodes, but also CDATA_SECTION_NODE nodes.

Also, I think we could use some unit tests for this. Thanks!
Comment 4 Rakesh CLA 2010-07-01 06:06:37 EDT
Created attachment 173193 [details]
Patch

I have added a check and a test file in jsp.core . This exception will occur only in jsp files whenever CDATA is first child of script or style.For example it occurs in <script><![CDATA[]]></script>  but not in 
<script>
<![CDATA[]]></script>
Please let me know if i need to make changes in test.I added test in jsp.core since it looks like a change related to jsp , although change is actually made in xml.core.
Comment 5 Nick Sandonato CLA 2010-07-01 13:38:36 EDT
Patch looks good, Rakesh.

Only thing I would change is to make the unit test part of HTML core's suite. There are a set under o.e.wst.html.core.tests.parser. Just extend the ModelTest base class, and you can call createHTMLModel() to get your HTML model for edit. Add your nodes, and do a catch(DOMException) { fail("Did not permit CDATA section in script element."); }

Then make sure to add it to the ModelParserTests test suite.

Thanks.
Comment 6 Rakesh CLA 2010-07-02 03:22:48 EDT
Created attachment 173272 [details]
patch

TestCase changed
Comment 7 Nick Sandonato CLA 2010-08-16 16:28:08 EDT
Released. Thanks, Rakesh.