Bug 239415 - Could not open the editor: Argument not valid when opening a JSP
Summary: Could not open the editor: Argument not valid when opening a JSP
Status: VERIFIED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 major with 1 vote (vote)
Target Milestone: 3.0.1   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: contributed
: 229851 238512 241492 243268 261015 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-03 05:46 EDT by Hendry CLA
Modified: 2009-01-16 15:04 EST (History)
8 users (show)

See Also:
thatnitind: review+


Attachments
Sample JSP that triggers the error (74 bytes, text/plain)
2008-07-09 19:11 EDT, Matthew CLA
no flags Details
patch to embedded linestyle provider for CSS (2.91 KB, patch)
2008-07-11 15:05 EDT, Nick Sandonato CLA
no flags Details | Diff
patch with boundary checking (5.82 KB, patch)
2008-07-14 16:17 EDT, Nick Sandonato CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hendry CLA 2008-07-03 05:46:53 EDT
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)
Comment 1 Matthew CLA 2008-07-04 02:07:34 EDT
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".
Comment 2 Matthew CLA 2008-07-04 02:20:48 EDT
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.
Comment 3 Ben CLA 2008-07-09 14:02:46 EDT
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.
Comment 4 Nick Sandonato CLA 2008-07-09 15:00:12 EDT
Could you attach an example JSP that is failing?
Comment 5 Matthew CLA 2008-07-09 19:11:46 EDT
Created attachment 107019 [details]
Sample JSP that triggers the error

Example JSP file attached.
Comment 6 Nick Sandonato CLA 2008-07-11 15:05:06 EDT
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.
Comment 7 Nitin Dahyabhai CLA 2008-07-14 00:29:15 EDT
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.
Comment 8 Nick Sandonato CLA 2008-07-14 10:46:04 EDT
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.
Comment 9 Nick Sandonato CLA 2008-07-14 13:18:48 EDT
*** Bug 229851 has been marked as a duplicate of this bug. ***
Comment 10 Nitin Dahyabhai CLA 2008-07-14 14:18:28 EDT
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.
Comment 11 Nick Sandonato CLA 2008-07-14 16:17:32 EDT
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.
Comment 12 Nitin Dahyabhai CLA 2008-07-17 00:20:20 EDT
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.
Comment 13 Nitin Dahyabhai CLA 2008-07-21 13:26:46 EDT
*** Bug 241492 has been marked as a duplicate of this bug. ***
Comment 14 Nick Sandonato CLA 2008-07-21 13:33:22 EDT
*** Bug 238512 has been marked as a duplicate of this bug. ***
Comment 15 Nick Sandonato CLA 2008-08-07 14:34:00 EDT
*** Bug 243268 has been marked as a duplicate of this bug. ***
Comment 16 Nick Sandonato CLA 2008-08-19 15:25:47 EDT
Verified in 3.0.1-20080818032401.
Comment 17 Nick Sandonato CLA 2009-01-16 15:04:44 EST
*** Bug 261015 has been marked as a duplicate of this bug. ***