Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342982 - [document] IStructuredDocumentRegion management failed.
Summary: [document] IStructuredDocumentRegion management failed.
Status: NEW
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal with 4 votes (vote)
Target Milestone: Future   Edit
Assignee: Salvador Zalapa CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-15 10:31 EDT by Patric Rufflar CLA
Modified: 2014-04-24 00:40 EDT (History)
4 users (show)

See Also:
zalapa: review? (nsand.dev)


Attachments
File to reproduce the bug (4.81 KB, text/plain)
2011-04-20 06:41 EDT, Patric Rufflar CLA
no flags Details
PHP file also experiencing problem during editing (6.63 KB, text/php)
2011-09-02 22:52 EDT, Missing name Mising name CLA
no flags Details
My error log -- all 4 entires were generated by this issue (22.56 KB, text/x-log)
2011-11-04 06:54 EDT, Janek Lasocki-Biczysko CLA
no flags Details
First patch (3.58 KB, patch)
2013-06-21 15:34 EDT, Salvador Zalapa CLA
zalapa: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patric Rufflar CLA 2011-04-15 10:31:04 EDT
Build Identifier: 3.2.3

org.eclipse.wst.xml.core.internal.document.StructuredDocumentRegionManagementException: IStructuredDocumentRegion management failed.
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.removeStructuredDocumentRegion(XMLModelParser.java:2265)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.replaceStructuredDocumentRegions(XMLModelParser.java:2339)
	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.nodesReplaced(DOMModelImpl.java:671)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:600)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1198)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1979)
	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:2415)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$3(JobSafeStructuredDocument.java:1)
	at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$4.run(JobSafeStructuredDocument.java:163)
	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:171)
	at org.eclipse.wst.sse.core.internal.undo.StructuredTextCommandImpl.redo(StructuredTextCommandImpl.java:84)
	at org.eclipse.emf.common.command.BasicCommandStack.redo(BasicCommandStack.java:182)
	at org.eclipse.wst.sse.core.internal.undo.StructuredTextUndoManager.redo(StructuredTextUndoManager.java:486)
	at org.eclipse.wst.sse.ui.StructuredTextViewerUndoManager.redo(StructuredTextViewerUndoManager.java:117)
	at org.eclipse.jface.text.TextViewer.doOperation(TextViewer.java:3959)
	at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:1005)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1534)
	at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.doOperation(StructuredTextViewer.java:611)
	at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:131)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:129)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
	at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1253)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	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:4270)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4162)
	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:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	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(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)


Reproducible: Sometimes

Steps to Reproduce:
I did some changes in a jsp and did some undo/redo operations
Comment 1 Patric Rufflar CLA 2011-04-15 10:48:33 EDT
I saw this exception also during formatting a jsp
Comment 2 Nick Sandonato CLA 2011-04-19 10:21:04 EDT
Hi, Patric.

Do you have an example source file that was problematic for you? This may very well be dependent on the contents of the source file.
Comment 3 Patric Rufflar CLA 2011-04-20 06:41:11 EDT
Created attachment 193679 [details]
File to reproduce the bug

Hi Nick,

I am now able to reproduce the bug.
Open the attached file in a jsp editor.

Mark lines 110 - 120
Press ALT-Down and keep holding the keys down and have a look at the opened error view.

Please note that I saw this bug also without using ALT-Down, so there are more "regular" cases than ALT-Down which will hit this bug.
Comment 4 Missing name Mising name CLA 2011-09-02 22:52:53 EDT
Created attachment 202703 [details]
PHP file also experiencing problem during editing

Got same exception editing attached Drupal page template PHP file in Mac env.  What I saw while editing was that trying to type in a <div> tag or closing <div> tag caused characters to show up out of order (look at line 155 -- I tried typing that in as </div> more than once.  I kept getting the mixed up output.  The Eclipse error view showed the exception from this bug report as well as 2 other exceptions:

1) Unhandled event loop exception  
java.lang.Error: Error: could not match input
	at org.eclipse.wst.xml.core.internal.parser.XML10Names.zzScanError(XML10Names.java:473)
	at org.eclipse.wst.xml.core.internal.parser.XML10Names.isValidXML10Name(XML10Names.java:588)
	at org.eclipse.wst.xml.core.internal.parser.XML10Names.isValidXML10Name(XML10Names.java:271)
	at org.eclipse.wst.xml.core.internal.provisional.NameValidator.isValid(NameValidator.java:50)
	at org.eclipse.wst.xml.core.internal.document.DocumentImpl.isValidName(DocumentImpl.java:1015)
	at org.eclipse.wst.xml.core.internal.document.DocumentImpl.checkTagNameValidity(DocumentImpl.java:258)
	at org.eclipse.php.internal.core.documentModel.dom.DOMDocumentForPHP.createElement(DOMDocumentForPHP.java:44)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertStartTag(XMLModelParser.java:1482)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertStructuredDocumentRegion(XMLModelParser.java:1510)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.replaceStructuredDocumentRegions(XMLModelParser.java:2354)
	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.handleRefresh(DOMModelImpl.java:524)
	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.nodesReplaced(DOMModelImpl.java:742)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:600)
.....

2) assertion failed:
org.eclipse.core.runtime.AssertionFailedException: assertion failed: 
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
	at org.eclipse.ui.internal.texteditor.quickdiff.DocumentLineDiffer.handleAboutToBeChanged(DocumentLineDiffer.java:794)
	at org.eclipse.ui.internal.texteditor.quickdiff.DocumentLineDiffer.documentAboutToBeChanged(DocumentLineDiffer.java:763)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireDocumentAboutToChange(BasicStructuredDocument.java:389)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireDocumentAboutToChanged(BasicStructuredDocument.java:1120)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1912)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2423)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2408)
	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.ui.internal.StructuredDocumentToTextAdapter.replaceTextRange(StructuredDocumentToTextAdapter.java:1187)
	at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7180)
	at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7994)
......

My environment:

eclipse.buildId=I20110613-1736
java.version=1.6.0_26
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -keyring /Users/yasmin/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.jee.product -keyring /Users/yasmin/.eclipse_keyring -showlocation
Comment 5 Jorrit Schippers CLA 2011-10-13 01:37:58 EDT
For me, the problem appears when typing the < character in some places in a mixed PHP/HTML file. It only happens when the tag nesting is deep, for instance 3 levels of <div>'s

The exception is accompanied by the following exception:

java.lang.Error: Error: could not match input
	at org.eclipse.wst.xml.core.internal.parser.XML10Names.zzScanError(XML10Names.java:473)
	at org.eclipse.wst.xml.core.internal.parser.XML10Names.isValidXML10Name(XML10Names.java:588)
	at org.eclipse.wst.xml.core.internal.parser.XML10Names.isValidXML10Name(XML10Names.java:271)
	at org.eclipse.wst.xml.core.internal.provisional.NameValidator.isValid(NameValidator.java:50)
	at org.eclipse.wst.xml.core.internal.document.DocumentImpl.isValidName(DocumentImpl.java:1015)
	at org.eclipse.wst.xml.core.internal.document.DocumentImpl.checkTagNameValidity(DocumentImpl.java:258)
	at org.eclipse.php.internal.core.documentModel.dom.DOMDocumentForPHP.createElement(DOMDocumentForPHP.java:44)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertStartTag(XMLModelParser.java:1482)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertStructuredDocumentRegion(XMLModelParser.java:1510)
	at org.eclipse.wst.xml.core.internal.document.XMLModelParser.replaceStructuredDocumentRegions(XMLModelParser.java:2354)
	at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.nodesReplaced(DOMModelImpl.java:737)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:600)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1198)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1979)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2423)
	at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2408)
	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.ui.internal.StructuredDocumentToTextAdapter.replaceTextRange(StructuredDocumentToTextAdapter.java:1187)
	at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7180)
	at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7994)
	at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456)
	at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5911)
	at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5941)
	at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5635)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Widget.sendIMKeyEvent(Widget.java:1344)
	at org.eclipse.swt.widgets.Control.gtk_commit(Control.java:2840)
	at org.eclipse.swt.widgets.Canvas.gtk_commit(Canvas.java:160)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1733)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
	at org.eclipse.swt.internal.gtk.OS._gtk_im_context_filter_keypress(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_im_context_filter_keypress(OS.java:7821)
	at org.eclipse.swt.widgets.Control.filterKey(Control.java:2250)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3012)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8422)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1245)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2276)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	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:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Comment 6 Janek Lasocki-Biczysko CLA 2011-11-04 06:51:13 EDT
Same issue (while editing PHP) over here. After one of these occur PHP validation beings to choke up as well..
Comment 7 Janek Lasocki-Biczysko CLA 2011-11-04 06:54:29 EDT
Created attachment 206456 [details]
My error log -- all 4 entires were generated by this issue
Comment 8 Nick Sandonato CLA 2011-11-18 15:44:57 EST
*** Bug 355298 has been marked as a duplicate of this bug. ***
Comment 9 Salvador Zalapa CLA 2013-06-21 15:33:22 EDT
This issue is pretty easy to reproduce. With the following snippet code:
<html>
 <table>
  <TR>
  <TR a="a">
    <TD b="b"></TD>
    <td>
  </TR>
 </table>
</html>

Try to move some endTagOmissible element or try to modify and undo, some element an the exception is going to be logged. The issue is that the model is being corrupted and the elements are placed in a wrong order into the model. BTW following the instructions from comment 3, the issue happens as well but it is a little bit difficult to visualize.  I am attaching a first patch version to review.
Comment 10 Salvador Zalapa CLA 2013-06-21 15:34:26 EDT
Created attachment 232664 [details]
First patch
Comment 11 Salvador Zalapa CLA 2013-07-24 12:55:34 EDT
Yes, I am in compliance with the Certificate of Origin
Comment 12 Nick Sandonato CLA 2014-04-24 00:40:39 EDT
The changes are a little risky at this point. I'll push this out with the intention of revisiting in the next release.