Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: Open a JSP file using Eclipse JSP Editor. The JSP file contains jsp:useBean, scriptlet, javascript, HTML, etc. More information: The following exception was printed out on Eclipse: java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(SWT.java:3761) at org.eclipse.swt.SWT.error(SWT.java:3695) at org.eclipse.swt.SWT.error(SWT.java:3666) at org.eclipse.swt.custom.StyledText.setStyleRanges(StyledText.java:7914) at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:6376) at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4442) at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4521) at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.applyTextRegionCollection(StructuredPresentationReconciler.java:1086) at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.processDamage(StructuredPresentationReconciler.java:1061) at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler$InternalListener.inputDocumentChanged(StructuredPresentationReconciler.java:470) at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.install(StructuredPresentationReconciler.java:805) at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.updateHighlighter(StructuredTextViewer.java:933) at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.setDocument(StructuredTextViewer.java:791) at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:496) at org.eclipse.ui.texteditor.AbstractTextEditor.initializeSourceViewer(AbstractTextEditor.java:3807) at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3363) at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:53) at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:394) at org.eclipse.wst.sse.ui.StructuredTextEditor.createPartControl(StructuredTextEditor.java:1583) at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:428) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594) at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:306) at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180) at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270) at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65) at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473) at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256) at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209) at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608) at org.eclipse.ui.internal.PartStack.add(PartStack.java:499) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103) at org.eclipse.ui.internal.PartStack.add(PartStack.java:485) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112) at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63) at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:217) at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:207) at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:779) at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:678) at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:639) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2817) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2729) at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2721) at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2673) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2652) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2643) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:646) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:605) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:318) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:160) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:207) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250) at org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:50) at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:221) at org.eclipse.ui.internal.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:184) at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:820) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:880) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:818) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1079) at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:372) at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1183) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:263) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:257) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:297) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) 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:382) 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:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
I get the same exception, using Ganymede on Ubuntu Hardy. It appears to be related to MIME type detection. I have some JSP files that will consistently trigger the exception, and others that consistently open correctly. Those that fail are recognized by Nautilus as being of type "text/x-matlab".
I'm able to open one of the problem files by executing a search that causes it to appear in the results view, and then using the "Show next match" to jump into the file. Syntax highlighting is randomly broken past the first line, but content assist works as it should.
I also experience this issue with one .jsp file. Most files open without issues, but one file cannot be opened in the JSP Editor (identical exception as in bug report). I am able to open the file without issue in the Text Editor.
Could you attach an example JSP that is failing?
Created attachment 107019 [details] Sample JSP that triggers the error Example JSP file attached.
Created attachment 107228 [details] patch to embedded linestyle provider for CSS This patch should fix the linestyle provider for embedded CSS so that Style regions do not overlap. This exception was occurring because of the scriptlet that was within a CSS token. Two style ranges (one for CSS and one for the scriptlet) were being added to the presentation that overlapped.
Nick, is there also a way to add boundary checking into the presentation reconciler without slowing things down too much? I'm concerned that line style providers added through extension points could easily break our editors.
I don't think there's any speedy way of doing boundary checking on the style ranges without iterating over all of them. This seems like a harsh penalty for normally well-behaved editors.
*** Bug 229851 has been marked as a duplicate of this bug. ***
I mean more of making sure that the range of StyleRanges returned from each provider didn't overlap along the edges of their partitions, not taking it further and checking that each provider itself also didn't return overlapping StyleRanges.
Created attachment 107382 [details] patch with boundary checking This builds off of the previous patch. I've added a check in the StructuredDocumentDamagerRepairer that, after asking the provider for a list of StyleRanges, verifies that the first StyleRange begins inside of the typed region and the last StyleRange does not expand outside of the typed region. I've also updated the javadoc on the LineStyleProvider so that it notes the added StyleRanges should not expand outside of the provided typed region.
Applied, but without an Iterator in StructuredDocumentDamagerRepairer. Since the implementation of the List (as an ArrayList) is known, it's skip the extra Iterator object with its threading checks and to use the ArrayList directly to retrieve the StyleRanges.
*** Bug 241492 has been marked as a duplicate of this bug. ***
*** Bug 238512 has been marked as a duplicate of this bug. ***
*** Bug 243268 has been marked as a duplicate of this bug. ***
Verified in 3.0.1-20080818032401.
*** Bug 261015 has been marked as a duplicate of this bug. ***