Bug 465972 - [projection] ProjectionViewer with no offset and length to 0 in editor throw exception
Summary: [projection] ProjectionViewer with no offset and length to 0 in editor throw ...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jonah Graham CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
: 466063 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-04-30 13:43 EDT by Jonah Graham CLA
Modified: 2020-08-21 13:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonah Graham CLA 2015-04-30 13:43:56 EDT
Further problem similar to Bug 465684, but this time for ProjectionViewer instead of SourceViewer.

Doing:
  editor.showHighlightRangeOnly(true);
  editor.setHighlightRange(0, 0, true);
When editor is an editor using a ProjectionViewer causes the following stack trace (this stack trace is from within a test I will submit soon):

SegmentedModeTest.testShowNothingProjectionViewer
testShowNothingProjectionViewer(org.eclipse.ui.editors.tests.SegmentedModeTest)
org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.core.runtime.AssertionFailedException: assertion failed: )
	at org.eclipse.swt.SWT.error(SWT.java:4441)
	at org.eclipse.swt.SWT.error(SWT.java:4356)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:139)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3774)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3412)
	at org.eclipse.ui.editors.tests.SegmentedModeTest.testShowNothingProjectionViewer(SegmentedModeTest.java:156)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at junit.framework.TestCase.runTest(TestCase.java:176)
	at junit.framework.TestCase.runBare(TestCase.java:141)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:129)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3774)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3412)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:47)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: 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.jface.text.Position.<init>(Position.java:62)
	at org.eclipse.jface.text.AbstractDocument.getPositions(AbstractDocument.java:1750)
	at org.eclipse.core.internal.filebuffers.SynchronizableDocument.getPositions(SynchronizableDocument.java:277)
	at org.eclipse.jface.text.source.AnnotationModel.getRegionAnnotationIterator(AnnotationModel.java:738)
	at org.eclipse.jface.text.source.AnnotationModel.getAnnotationIterator(AnnotationModel.java:700)
	at org.eclipse.jface.text.source.AnnotationRulerColumn.doPaint1(AnnotationRulerColumn.java:718)
	at org.eclipse.jface.text.source.AnnotationRulerColumn.doubleBufferPaint(AnnotationRulerColumn.java:532)
	at org.eclipse.jface.text.source.AnnotationRulerColumn.redraw(AnnotationRulerColumn.java:815)
	at org.eclipse.jface.text.source.AnnotationRulerColumn$6.run(AnnotationRulerColumn.java:798)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
	... 49 more
Comment 1 Jonah Graham CLA 2015-04-30 13:45:22 EDT
I am working to see if I can find a fix for this. But in the meantime if anyone has any ideas I would be most welcome to them. I'll post my testcase soon too.
Comment 2 Jonah Graham CLA 2015-04-30 13:47:38 EDT
The editor in Comment 0 looks like this:

public class TestSegmentedEditor extends TextEditor {

	public static final String EDITOR_ID= "org.eclipse.ui.editors.tests.segmentededitor";

	protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
		fAnnotationAccess= getAnnotationAccess();
		fOverviewRuler= createOverviewRuler(getSharedColors());
		ISourceViewer viewer= new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
		// ensure decoration support has been created and configured.
		getSourceViewerDecorationSupport(viewer);

		return viewer;
	}
}

i.e. a TextEditor with only ProjectionViewer instead of SourceViewer. I am trying to recreate a minimal test case, as the same problem occurs if I use CDT's CEditor (which uses a ProjectionViewer subclass too).
Comment 3 Eclipse Genie CLA 2015-05-01 08:50:29 EDT
New Gerrit change created: https://git.eclipse.org/r/46954
Comment 4 Dani Megert CLA 2016-08-11 12:35:48 EDT
*** Bug 466063 has been marked as a duplicate of this bug. ***
Comment 5 Dani Megert CLA 2017-08-22 10:55:12 EDT
(In reply to Jonah Graham from comment #2)

Sorry for the long delay. I now added TextEditor#createSourceViewer with the code from comment 2 and could not reproduce the problem on master.

Could you please give me detailed steps to reproduce the problem?
Comment 6 Dani Megert CLA 2017-09-10 09:06:30 EDT
Waiting for response.
Comment 7 Jonah Graham CLA 2017-10-18 05:02:24 EDT
(In reply to Dani Megert from comment #6)
> Waiting for response.

Sorry for the delay. The attached gerrit sort of shows the problem. Since the test was written something has changed in how errors are logged. If you apply the gerrit, minus the code fix, and run it you should see a stack trace in the error log similar to Comment #0. 

At the moment our product has stopped using the ProjectionViewer in this way and I am failing to provide a better test case that demonstrates the problem.
Comment 8 Dani Megert CLA 2017-11-02 10:28:40 EDT
(In reply to Jonah Graham from comment #7)
> Since
> the test was written something has changed in how errors are logged. If you
> apply the gerrit, minus the code fix, and run it you should see a stack
> trace in the error log similar to Comment #0. 

Can't you turn that into a test failure?
Comment 9 Dani Megert CLA 2018-01-29 10:09:38 EST
Please set a target milestone again when you really plan to work on it.
Comment 10 Eclipse Genie CLA 2020-08-21 13:05:18 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.