Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 236472

Summary: Multiple problems caused by Compare Editor
Product: [Eclipse Project] Platform Reporter: Boris Bokowski <bokowski>
Component: CompareAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: brian.vosburgh, owong, remy.suen
Version: 3.4   
Target Milestone: 3.4.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
log file
none
Fix v01
none
mylyn/context/zip none

Description Boris Bokowski CLA 2008-06-10 13:23:24 EDT
Created attachment 104353 [details]
log file

Lots of errors (and warnings) in my log, I am running I20080606-0100.  I had a good number of follow-up problems it seems, including a refactoring that could not be performed because of a "widget is disposed". I had to close all editors to get back into a good state.

Attaching the .log file...
Comment 1 Tomasz Zarna CLA 2008-06-11 05:10:30 EDT
What is strange here is that some parts of the log point to meaningless (in terms of an exception thrown) lines:
---
java.lang.NullPointerException
	at org.eclipse.compare.internal.merge.DocumentMerger.doDiff(DocumentMerger.java:452)

452: 	RangeDifference[] e= null;
---
org.eclipse.swt.SWTException: Graphic is disposed
	at org.eclipse.swt.SWT.error(SWT.java:3777)
	at org.eclipse.swt.SWT.error(SWT.java:3695)
	at org.eclipse.swt.SWT.error(SWT.java:3666)
	at org.eclipse.swt.graphics.Image.getBounds(Image.java:1148)
	at org.eclipse.swt.custom.CLabel.getTotalSize(CLabel.java:225)
	at org.eclipse.swt.custom.CLabel.computeSize(CLabel.java:157)
	at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.getHeaderHeight(ContentMergeViewer.java:1054)

1054: 	 */
---
Any thoughts? Is it possible that some of your/my code is outdated? I sync with head every day, even though I produce most of the changes :)

The NPE in SaveableCompareEditorInput and IllegalArgumentException from Cache look fine, I mean their stack traces look fine.	Boris, any chance for some steps to reproduce?

As for the warnings part, it's very similar to what Krzysztof reported last year in bug 203461, don't you think?
Comment 2 Boris Bokowski CLA 2008-06-11 09:26:46 EDT
DocumentMerger.java:452 looks like this to me:

for (int i= 0; i < e.length; i++) {

and ContentMergeViewer:1054 looks like:

headerHeight= Math.max(headerHeight, fDirectionLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y);		
Comment 3 Tomasz Zarna CLA 2008-06-11 09:32:11 EDT
(In reply to comment #2)
> DocumentMerger.java:452 looks like this to me:
> 
> for (int i= 0; i < e.length; i++) {
> 
> and ContentMergeViewer:1054 looks like:
> 
> headerHeight= Math.max(headerHeight, fDirectionLabel.computeSize(SWT.DEFAULT,
> SWT.DEFAULT, true).y);            
> 

My fault, wrong workspace, sorry.

Comment 4 Tomasz Zarna CLA 2008-06-11 09:46:50 EDT
Looks like another victim of fixing bug 228004.
Comment 5 Tomasz Zarna CLA 2008-06-13 08:35:14 EDT
IMO we're dealing here with couple of issues. This is what I've figured out so far:

1. In regards to the warnings from the log I think we should reopen bug 203461. It's a pity we didn't get any steps, but still it looks like a real problem.
2. The IllegalArgumentException thrown in ListenerList.remove is caused by superfluous nulling the contextListener in ModelCompareEditorInput (see bug 228004)
3. The NPE in SaveableCompareEditorInput$InternalResourceSaveableComparison.registerSaveable has a very similar cause. Nulling "saveable" in SaveableCompareEditorInput, may force us to recreate it, and throw the NullPointerException while registering the new saveable. Again, see bug 228004.
4. I'm still investigation "Graphic is disposed" exceptions.
5. The NPE in DocumentMerger.doDiff looks like a timing issue to me. Is it possible that the differencer (runnable from DocumentMerger.doDiff) got cancelled and we didn't handle the interruption properly?
Comment 6 Tomasz Zarna CLA 2008-07-14 11:39:30 EDT
*** Bug 239869 has been marked as a duplicate of this bug. ***
Comment 7 Remy Suen CLA 2008-07-15 23:44:37 EDT
Just wanted to say that I was getting the IAE on ListenerList myself on I20080715-1015. To reproduce the error, I had to double-click on one modified file in the 'Synchronize' view and then immediately double-click on another modified file.

My line numbers seems to match Boris's exactly.

java.lang.IllegalArgumentException
	at org.eclipse.core.runtime.ListenerList.remove(ListenerList.java:155)
	at org.eclipse.team.internal.core.Cache.removeCacheListener(Cache.java:83)
	at org.eclipse.team.internal.ui.mapping.ModelCompareEditorInput.handleDispose(ModelCompareEditorInput.java:84)
	at org.eclipse.compare.CompareEditorInput$4.widgetDisposed(CompareEditorInput.java:528)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:117)
Comment 8 Tomasz Zarna CLA 2008-07-16 10:58:16 EDT
Created attachment 107624 [details]
Fix v01

Patch fixing IAE on ListenerList and NPE on SaveableCompareEditorInput$InternalResourceSaveableComparison (which are points 2 and 3 from comment 5). 

As suggested in point 1, I opened bug 203461 to address handlers conflict issue. 

For problems described in points 4 and 5 I will open separate bugs as finding a cause/fix for them is still in progress.
Comment 9 Tomasz Zarna CLA 2008-07-16 10:58:20 EDT
Created attachment 107625 [details]
mylyn/context/zip
Comment 10 Tomasz Zarna CLA 2008-07-16 11:18:22 EDT
(In reply to comment #8)
> For problems described in points 4 and 5 I will open separate bugs as finding a
> cause/fix for them is still in progress.

See bug 241105 and bug 241007 accordingly.
Comment 11 Tomasz Zarna CLA 2008-07-17 07:53:08 EDT
Released both in HEAD and R3_4_maintenance stream.
Comment 12 Tomasz Zarna CLA 2008-09-08 12:15:50 EDT
(In reply to comment #10)

> See bug 241105 and bug 241007 accordingly.

The later bug is bug 241107.

Comment 13 Tomasz Zarna CLA 2008-09-08 12:16:53 EDT
*** Bug 245964 has been marked as a duplicate of this bug. ***