| Summary: | NPE after opening Compare Editor from Synchronize Perspective: at org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement.fetchAuthor(LocalResourceTypedElement.java:383) | ||
|---|---|---|---|
| Product: | [Technology] EGit | Reporter: | Daniel Hiller <dhiller> |
| Component: | Core | Assignee: | Robin Stocker <robin> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | blizzy, ecwid.tester, matthias.sohn, remy.suen, robin |
| Version: | 2.1 | ||
| Target Milestone: | 2.3 | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Daniel Hiller
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)
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). Fix pushed to review: https://git.eclipse.org/r/8405 merged as fbc5596c971b1194d67b5a18fd18c2dac50b89cf |