eclipse-egit / egit

EGit, the git integration of Eclipse IDE
https://www.eclipse.org/egit/
Eclipse Public License 2.0
13 stars 6 forks source link

IllegalStateException during viewing History #31

Closed rnveach closed 2 months ago

rnveach commented 2 months ago

Version

6.9.0

Operating System

Windows

Eclipse version

2023-06

Bug description

I have some repositories with several merge commits and branching lines. I like to compare versions in the History to see what is overall changed and not view each commit individually, so i select 2 commits in the history view and select "Compare with Each Other".

The "Comparing XXX with YYY" window comes up and shows me the initial file. Everything seems fine. However, when I switch from this initial file to another by double clicking using the "Structure Compare" it always abends and throws an IllegalStateException. When this happens, I can't view any other files, even the initial one which was working fine. This nearly always happens to me and won't let me view the history in this method.

Actual behavior

java.lang.IllegalStateException
    at org.eclipse.jface.text.TextViewer.setHyperlinkPresenter(TextViewer.java:5639)
    at org.eclipse.jface.text.source.SourceViewer.configure(SourceViewer.java:537)
    at org.eclipse.ui.internal.genericeditor.compare.GenericEditorMergeViewer.configureTextViewer(GenericEditorMergeViewer.java:68)
    at org.eclipse.ui.internal.genericeditor.compare.GenericEditorMergeViewer$1.inputDocumentChanged(GenericEditorMergeViewer.java:50)
    at org.eclipse.jface.text.TextViewer.fireInputDocumentChanged(TextViewer.java:2849)
    at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2890)
    at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:682)
    at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:622)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer$ContributorInfo.updateViewerDocument(TextMergeViewer.java:807)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer$ContributorInfo.internalSetDocument(TextMergeViewer.java:762)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer$ContributorInfo.setDocument(TextMergeViewer.java:679)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.updateContent(TextMergeViewer.java:3051)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.internalRefresh(ContentMergeViewer.java:793)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.inputChanged(ContentMergeViewer.java:701)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:282)
    at org.eclipse.compare.CompareViewerSwitchingPane.setViewer(CompareViewerSwitchingPane.java:133)
    at org.eclipse.compare.CompareViewerSwitchingPane.setInput(CompareViewerSwitchingPane.java:265)
    at org.eclipse.compare.internal.CompareContentViewerSwitchingPane.setInput(CompareContentViewerSwitchingPane.java:202)
    at org.eclipse.compare.CompareEditorInput.internalSetContentPaneInput(CompareEditorInput.java:806)
    at org.eclipse.compare.CompareEditorInput.lambda$8(CompareEditorInput.java:754)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
    at org.eclipse.compare.CompareEditorInput.feed1(CompareEditorInput.java:742)
    at org.eclipse.compare.CompareEditorInput.lambda$4(CompareEditorInput.java:640)
    at org.eclipse.compare.CompareViewerPane.open(CompareViewerPane.java:312)
    at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:800)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
    at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:797)
    at org.eclipse.egit.ui.internal.merge.GitDiffTreeViewer.fireOpen(GitDiffTreeViewer.java:70)
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1116)
    at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:296)
    at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:331)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4274)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
eclipse.buildId=4.28.0.20230608-1200
java.version=17.0.7
java.vendor=Red Hat, Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

Expected behavior

For it to show me the file with the overall differences that occurred between the 2 commits.

Relevant log output

See actual behavior.

Other information

I did try upgrading to the latest through the marketplace and it still happens. This issue has been happening for at least a year, and I am reporting it now. I am not sure what version I was on before this upgrade.

iloveeclipse commented 2 months ago

1) Seeing GenericEditorMergeViewer involved, I wonder if that only affects file types configured to be opened with generic editor? Or is this problem independent from file type? 2) "However, when I switch from this initial file to another by double clicking using the "Structure Compare" - How exactly do you run the diff? I can't see files in the structure compare at all.

tomaswolf commented 2 months ago

Can reproduce (Eclipse 4.20.0, EGit 6.7.0).

  1. Does not occur with files that do not use the generic editor.
  2. I do. Select two commits in the history view, choose "Compare with Each Other" from the context menu. Shows a compact tree of all files that differ between the two commits in the "Structure Compare" pane of the compare editor.
  3. After the IllegalStateException occurred, I can still "switch back" to other files that do not open the generic editor.
  4. The IllegalStateException does not always occur. Sometimes, I can open the comparison just fine, even if it failed previously for the same file.
  5. The IllegalStateException indicates that code tries to set a hyperlink presenter twice. Code location in current master is at line 5644.

In conclusion: seems to be a problem with the generic editor, not with EGit.

@rnveach : please try with the latest Eclipse version. Possibly the problem was fixed there.

tomaswolf commented 2 months ago

Removing the "bug" label and closing this issue here in EGit. This is a bug in the generic editor, and the report is a duplicate of https://github.com/eclipse-platform/eclipse.platform.ui/issues/1043 . Another instance of this problem is reported at https://github.com/eclipse-wildwebdeveloper/wildwebdeveloper/issues/1092 .

See in particular the analysis at https://github.com/eclipse-wildwebdeveloper/wildwebdeveloper/issues/1092#issuecomment-1483804856 .

rnveach commented 2 months ago

Thank you. Using eclipse 2024-03 seemed to work.