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

Bug 358302

Summary: NPE in GitResourceVariantTreeSubscriber.refresh()
Product: [Technology] EGit Reporter: Matthias Sohn <matthias.sohn>
Component: UIAssignee: Project Inbox <egit.ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: alessio.pollero, ankur_sharma, daniel_megert, dariusz.luksza, ingo.siebert, irbull, malaperle, markus.kell.r, remy.suen, res1st, sam.davis
Version: 1.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Matthias Sohn CLA 2011-09-20 16:19:22 EDT
I don't remember what I did when I hit this NPE

eclipse.buildId=I20110613-1736
java.version=1.6.0_26
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.eclipse.platform.ide
Command-line arguments:  -product org.eclipse.platform.ide -data /Users/d029788/Documents/workspace/egit/../runtime-EGit -dev file:/Users/d029788/Documents/workspace/egit/.metadata/.plugins/org.eclipse.pde.core/EGit/dev.properties -os macosx -ws cocoa -arch x86_64 -consoleLog

Error
Tue Sep 20 22:05:41 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 1 Markus Keller CLA 2011-09-22 09:10:57 EDT
I get it when I invoke Commit from the context menu of the Synchronize view.

I have 5 changed files in the same folder, presentation set to Workspace, and as selected item the parent folder (concretely, the compressed folder /org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events).
Comment 2 Robert Munteanu CLA 2011-09-22 09:35:53 EDT
I also get this error when Invoking Team -> Add from the package explorer on a package which has untracker files. The files are added to the index nevertheless.
Comment 3 Dani Megert CLA 2011-09-28 04:56:37 EDT
*** Bug 359056 has been marked as a duplicate of this bug. ***
Comment 4 Ankur Sharma CLA 2011-10-09 07:28:24 EDT
*** Bug 359800 has been marked as a duplicate of this bug. ***
Comment 5 Benjamin Muskalla CLA 2011-10-10 06:54:36 EDT
*** Bug 360335 has been marked as a duplicate of this bug. ***
Comment 6 Ian Bull CLA 2011-10-12 15:16:53 EDT
I get this each time I commit. I do all my commits from the synchronize view.
Comment 7 Ian Bull CLA 2011-10-12 15:37:34 EDT
(In reply to comment #6)
> I get this each time I commit. I do all my commits from the synchronize view.

Actually, it appears to happen when I select all the resources in the synchronize view before committing. I always do this because I want these resources to be committed... I hide/remove from view the things I don't want committed, select all, commit.  This seems to reproduce the NPE each time.
Comment 8 Dariusz Luksza CLA 2011-10-18 13:41:13 EDT
(In reply to comment #7)
> Actually, it appears to happen when I select all the resources in the
> synchronize view before committing. I always do this because I want these
> resources to be committed... I hide/remove from view the things I don't want
> committed, select all, commit.  This seems to reproduce the NPE each time.

I cannot reproduce this NPE on latest version of EGit from master branch and my small test project. Current version of GitResourceVariantTreeSubscriber in line 141 contains static method call so it cannot cause NPE.

Ian, it would be nice if you could try to reproduce this on latest nightly build and send updated stacktrace.
Comment 9 Remy Suen CLA 2011-10-28 18:31:38 EDT
*** Bug 362378 has been marked as a duplicate of this bug. ***
Comment 10 Remy Suen CLA 2011-11-24 14:45:59 EST
*** Bug 364629 has been marked as a duplicate of this bug. ***
Comment 11 Matthias Sohn CLA 2011-11-25 17:29:34 EST
Tried to reproduce the scenario Ian described using today's (2011-11-25) 
nightly build. Works as expected and no NPE is thrown. 
Seems this was already fixed as Dariusz suspected.
Hence closing this bug report.
Comment 12 Kevin Sawicki CLA 2012-01-23 12:59:38 EST
*** Bug 368531 has been marked as a duplicate of this bug. ***
Comment 13 Ian Bull CLA 2012-01-23 13:10:24 EST
Yes, I've not seen this since moving to recent builds (build from Jan 2012).
Comment 14 Kevin Sawicki CLA 2012-02-07 11:04:28 EST
*** Bug 370792 has been marked as a duplicate of this bug. ***