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

Bug 358621

Summary: NPE in GitResourceVariantTreeSubscriber
Product: [Technology] EGit Reporter: Wim Jongman <wim.jongman>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahmed.javed, bugzilla3704, daniel.stein, gunnar, matthias.sohn, nicolas.bros, remy.suen, steve
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 354932    

Description Wim Jongman CLA 2011-09-22 12:21:04 EDT
It will throw a npe and will disable the SVN decorator:


java.lang.NullPointerException
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber.shouldBeIncluded(GitResourceVariantTreeSubscriber.java:206)
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber.members(GitResourceVariantTreeSubscriber.java:102)
	at org.eclipse.team.core.subscribers.Subscriber.accept(Subscriber.java:435)
	at org.eclipse.team.core.subscribers.Subscriber.accept(Subscriber.java:424)
	at org.eclipse.team.core.subscribers.Subscriber.accept(Subscriber.java:396)
	at org.eclipse.team.core.subscribers.Subscriber.getState(Subscriber.java:502)
	at org.eclipse.team.ui.synchronize.SubscriberTeamStateProvider.getSynchronizationState(SubscriberTeamStateProvider.java:101)
	at org.eclipse.team.ui.synchronize.SubscriberTeamStateProvider.getSynchronizationState(SubscriberTeamStateProvider.java:88)
	at org.eclipse.team.ui.synchronize.SubscriberTeamStateProvider.getStateDescription(SubscriberTeamStateProvider.java:124)
	at org.eclipse.team.internal.ui.mapping.WorkspaceTeamStateProvider.getStateDescription(WorkspaceTeamStateProvider.java:105)
	at org.eclipse.team.ui.mapping.SynchronizationStateTester.getState(SynchronizationStateTester.java:154)
	at org.tigris.subversion.subclipse.ui.decorator.SVNLightweightDecorator.decorate(SVNLightweightDecorator.java:345)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:263)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:81)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:365)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:347)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:370)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:330)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Wim Jongman CLA 2011-09-22 12:21:16 EDT
eclipse.buildId=I20110613-1736
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=nl_NL
Command-line arguments:  -os win32 -ws win32 -arch x86
Comment 2 Wim Jongman CLA 2011-09-22 12:22:19 EDT
build: I20110613-1736

  Eclipse EGit	1.1.0.201109151100-r	org.eclipse.egit.feature.group	Eclipse EGit
  Eclipse EGit - Source	1.1.0.201109151100-r	org.eclipse.egit.source.feature.group	Eclipse EGit
  Eclipse JGit	1.1.0.201109151100-r	org.eclipse.jgit.feature.group	Eclipse JGit
  Eclipse JGit - Source	1.1.0.201109151100-r	org.eclipse.jgit.source.feature.group	Eclipse JGit
Comment 3 Daniel Stein CLA 2011-09-29 04:07:31 EDT
I have the same problem: 
If I select a package underneath a project and select the Commit-Action I get the following trace: 



eclipse.buildId=M20110909-1335
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.rcp.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.rcp.product

Error
Thu Sep 29 10:00:42 CEST 2011
Error occurred while building scope for committing changes

java.lang.NullPointerException
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber.refresh(GitResourceVariantTreeSubscriber.java:141)
	at org.eclipse.team.core.subscribers.SubscriberResourceMappingContext.refresh(SubscriberResourceMappingContext.java:167)
	at org.eclipse.team.core.subscribers.SubscriberResourceMappingContext.ensureRefreshed(SubscriberResourceMappingContext.java:207)
	at org.eclipse.team.core.subscribers.SubscriberResourceMappingContext.fetchMembers(SubscriberResourceMappingContext.java:132)
	at org.eclipse.jdt.internal.corext.util.JavaElementResourceMapping.getRemotePackageFragmentTraversals(JavaElementResourceMapping.java:233)
	at org.eclipse.jdt.internal.corext.util.JavaElementResourceMapping.access$0(JavaElementResourceMapping.java:225)
	at org.eclipse.jdt.internal.corext.util.JavaElementResourceMapping$PackageFragmentResourceMapping.getTraversals(JavaElementResourceMapping.java:198)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.addMappingsToScope(SynchronizationScopeManager.java:389)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.internalPrepareContext(SynchronizationScopeManager.java:200)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.access$0(SynchronizationScopeManager.java:187)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager$1.run(SynchronizationScopeManager.java:167)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.initialize(SynchronizationScopeManager.java:165)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager.access$0(SubscriberScopeManager.java:1)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager$1.run(SubscriberScopeManager.java:81)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager.initialize(SubscriberScopeManager.java:79)
	at org.eclipse.team.ui.synchronize.ModelOperation.initializeScope(ModelOperation.java:161)
	at org.eclipse.team.ui.synchronize.ModelOperation.beginOperation(ModelOperation.java:124)
	at org.eclipse.team.ui.synchronize.ModelOperation.run(ModelOperation.java:105)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil.collectRelatedChanges(GitScopeUtil.java:168)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil.access$0(GitScopeUtil.java:158)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil$1.run(GitScopeUtil.java:141)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 4 Matthias Sohn CLA 2011-09-30 17:41:02 EDT
Proposed patch http://egit.eclipse.org/r/4317
Comment 5 Wim Jongman CLA 2011-10-06 12:16:37 EDT
I installed the nightly builds from http://download.eclipse.org/egit/updates-nightly/

but it is not fixed there. Is there another repos where i can get the patch?
Comment 6 Remy Suen CLA 2011-10-06 12:20:03 EDT
(In reply to comment #5)
> I installed the nightly builds from
> http://download.eclipse.org/egit/updates-nightly/
> 
> but it is not fixed there.

The patch has merely been _proposed_, not merged into master.

> Is there another repos where i can get the patch?

Since the patch has not yet been merged, it is currently not available for consumption from an update site.
Comment 7 Wim Jongman CLA 2011-10-07 03:13:03 EDT
Thanks for elaborating Remy. This process makes it difficult for me to test and provide feedback.
Comment 8 Matthias Sohn CLA 2011-10-08 19:24:06 EDT
merged as b54f41c5aa1ffa49bf92a645d76bf2a5d4c3a31e
Comment 9 Remy Suen CLA 2011-10-10 07:00:14 EDT
*** Bug 360395 has been marked as a duplicate of this bug. ***
Comment 10 Remy Suen CLA 2011-10-10 07:32:11 EDT
(In reply to comment #8)
> merged as b54f41c5aa1ffa49bf92a645d76bf2a5d4c3a31e

Still broken on 1.2.0.201110091909.

java.lang.NullPointerException
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber.shouldBeIncluded(GitResourceVariantTreeSubscriber.java:211)
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriber.members(GitResourceVariantTreeSubscriber.java:103)
	at org.eclipse.team.core.subscribers.Subscriber.accept(Subscriber.java:435)
	at org.eclipse.team.core.subscribers.Subscriber.accept(Subscriber.java:424)
	at org.eclipse.team.core.subscribers.Subscriber.accept(Subscriber.java:396)
	at org.eclipse.team.core.subscribers.Subscriber.getState(Subscriber.java:502)
	at org.eclipse.team.ui.synchronize.SubscriberTeamStateProvider.getSynchronizationState(SubscriberTeamStateProvider.java:101)
	at org.eclipse.team.ui.synchronize.SubscriberTeamStateProvider.getSynchronizationState(SubscriberTeamStateProvider.java:88)
	at org.eclipse.team.ui.synchronize.SubscriberTeamStateProvider.getStateDescription(SubscriberTeamStateProvider.java:124)
	at org.eclipse.team.internal.ui.mapping.WorkspaceTeamStateProvider.getStateDescription(WorkspaceTeamStateProvider.java:105)
	at org.eclipse.team.ui.mapping.SynchronizationStateTester.getState(SynchronizationStateTester.java:154)
	at org.tigris.subversion.subclipse.ui.decorator.SVNLightweightDecorator.decorate(SVNLightweightDecorator.java:345)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:263)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:81)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:365)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:347)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:370)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:330)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 11 Remy Suen CLA 2011-10-13 22:36:28 EDT
*** Bug 360822 has been marked as a duplicate of this bug. ***
Comment 12 Remy Suen CLA 2011-10-13 22:37:00 EDT
*** Bug 360823 has been marked as a duplicate of this bug. ***
Comment 13 Gunnar Wagenknecht CLA 2011-10-14 07:32:52 EDT
*** Bug 360806 has been marked as a duplicate of this bug. ***
Comment 14 Gunnar Wagenknecht CLA 2011-10-14 07:34:20 EDT
It's also not fixed in 1.2.0.20111011...
Comment 15 Gunnar Wagenknecht CLA 2011-10-14 07:39:16 EDT
Matthias, I suspect that (because of the SVN decorator causing this) the GitResourceVariantTreeSubscriber is called for a resource that's not in an EGit managed project. Thus, gsds.getData(proj) is NULL.

Thus, I'm wondering if there need to be additional null checks in shouldBeIncluded a or a more broader "is in git managed project" check at some earlier time?
Comment 16 Gunnar Wagenknecht CLA 2011-10-17 13:56:37 EDT
FWIW, the Subclipse team has wrapped the code into a try/catch block to handle broken third party code.

http://subclipse.tigris.org/issues/show_bug.cgi?id=1315

This might be interesting:
> The call out to SynchronizationStateTester is only 
> done when the element resource is null (i.e., a working set node)
Comment 17 Matthias Sohn CLA 2011-10-21 08:33:03 EDT
pushed http://egit.eclipse.org/r/#change,4387 for review
Comment 18 Wim Jongman CLA 2011-10-24 13:33:43 EDT
(In reply to comment #17)
> pushed http://egit.eclipse.org/r/#change,4387 for review

1.2.0.201110240523 fixed it for me. Thanks Matthias.
Comment 19 Remy Suen CLA 2011-10-28 18:32:35 EDT
(In reply to comment #18)
> (In reply to comment #17)
> > pushed http://egit.eclipse.org/r/#change,4387 for review
> 
> 1.2.0.201110240523 fixed it for me. Thanks Matthias.

Closing. Thanks Matthias for the fix and Wim for verifying it!