Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364704 - NPE after opening Compare Editor from Synchronize Perspective: at org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement.fetchAuthor(LocalResourceTypedElement.java:383)
Summary: NPE after opening Compare Editor from Synchronize Perspective: at org.eclipse...
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal with 1 vote (vote)
Target Milestone: 2.3   Edit
Assignee: Robin Stocker CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-24 06:20 EST by Daniel Hiller CLA
Modified: 2012-12-24 09:02 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Hiller CLA 2011-11-24 06:20:23 EST
Build Identifier: M20110909-1335

Error Log:

An internal error occurred during: "Updating Compare Editor".

Stacktrace:

java.lang.NullPointerException
	at org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement.fetchAuthor(LocalResourceTypedElement.java:383)
	at org.eclipse.team.internal.ui.mapping.ResourceDiffCompareInput.updateAuthorInfo(ResourceDiffCompareInput.java:357)
	at org.eclipse.team.internal.ui.mapping.ResourceCompareInputChangeNotifier.fetchAuthors(ResourceCompareInputChangeNotifier.java:327)
	at org.eclipse.team.internal.ui.mapping.ResourceCompareInputChangeNotifier$3.run(ResourceCompareInputChangeNotifier.java:321)
	at org.eclipse.team.internal.core.BackgroundEventHandler$RunnableEvent.run(BackgroundEventHandler.java:176)
	at org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier$InputChangeEventHandler.executeRunnableNow(CompareInputChangeNotifier.java:146)
	at org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier$InputChangeEventHandler.doDispatchEvents(CompareInputChangeNotifier.java:101)
	at org.eclipse.team.internal.core.BackgroundEventHandler.dispatchEvents(BackgroundEventHandler.java:394)
	at org.eclipse.team.internal.core.BackgroundEventHandler.processEvents(BackgroundEventHandler.java:374)
	at org.eclipse.team.internal.core.BackgroundEventHandler$1.run(BackgroundEventHandler.java:203)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Session data: 


eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE


Reproducible: Always

Steps to Reproduce:
1. Make changes to a java file in workspace
2. Project > Synchronize workspace (opening Sync perspective)
3. Douzble click to open compare editor on an edited java file
Comment 1 Carsten Reckord CLA 2012-01-30 11:14:06 EST
This also happens consistently when doing a 'Compare With->Local History' if 'Team->Show file author' preference is enabled. A simple workaround is to disable that preference.

As for the cause of the problem, the offending code in LocalResourceTypedElement reads:

		IFileRevision revision= fileHistoryProvider.getWorkspaceFileRevision(getResource());
		if (revision == null)
			return;

		// NOTE: Must not check for revision#isPropertyMissing() as this will always return true for the workspace file revision
		revision= revision.withAllProperties(monitor);

		author= revision.getAuthor();

With EGit installed, I originally get an instance of WorkspaceFileRevision from the history provider. Looking at the cause of the problem, there seem to be two issues coming together:

1. I don't know anything about the team API interna and Javadoc isn't clear here, but looking at other implementations of IFileRevision, the EGit implementations probably shouldn't just return null in withAllProperties(...)
2. the above code should probably guard against revision.withAllProperties(monitor) == null by using the original value:

		IFileRevision fullRevision = revision.withAllProperties(monitor);
		if (fullRevision != null)
				revision = fullRevision;

Searching for other occurrences of IFileRevision.withAllProperties(), this probably suffers from the same problem:
      org.eclipse.team.internal.ui.history.FileRevisionTypedElement.fetchAuthor(IProgressMonitor)
Comment 2 Maik Schreiber CLA 2012-06-11 09:16:46 EDT
Bug #358392 looks like it could be related.

Anyway, I'm still seeing this error in EGit 2.0.0.201206090913 (with Indigo SR 2, build 20120216-1857).
Comment 3 Robin Stocker CLA 2012-10-29 16:54:30 EDT
Fix pushed to review:

https://git.eclipse.org/r/8405
Comment 4 Matthias Sohn CLA 2012-12-24 09:02:59 EST
merged as fbc5596c971b1194d67b5a18fd18c2dac50b89cf