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

Bug 333281

Summary: NPE in ObjectIdSubclassMap.index
Product: [Technology] EGit Reporter: Hendrik Brummermann <nhb_web>
Component: CoreAssignee: Philipp Thun <philipp.thun>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: caniszczyk, christian.halstrick, matthias.sohn, sop
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Hendrik Brummermann CLA 2010-12-28 15:37:19 EST
Build Identifier: eclipse.buildId=M20100909-0800

java.lang.NullPointerException
at org.eclipse.jgit.lib.ObjectIdSubclassMap.index(ObjectIdSubclassMap.java:172)
at org.eclipse.jgit.lib.ObjectIdSubclassMap.get(ObjectIdSubclassMap.java:89)
at org.eclipse.jgit.revwalk.RevWalk.lookupCommit(RevWalk.java:629)
at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:136)
at org.eclipse.egit.core.op.MergeOperation$1.run(MergeOperation.java:102)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
at org.eclipse.egit.core.op.MergeOperation.execute(MergeOperation.java:122)
at org.eclipse.egit.ui.internal.actions.MergeActionHandler$1.run(MergeActionHandler.java:66)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


Reproducible: Always

Steps to Reproduce:
1. Create a new project
2. Share project, create local git repository
3. Fetch from a remote repository, everything
4. Team | Merge...


An internal error occurred during: "Merging with refs/remotes/origin/master".
Comment 1 Chris Aniszczyk CLA 2010-12-28 15:52:43 EST
What version of JGit are you using?
Comment 2 Shawn Pearce CLA 2011-03-14 11:27:43 EDT
This is an EGit bug. EGit is passing in a null ObjectId. This part of JGit does not check for null arguments because we go through these routines so often that the null check is prohibitive.

Look at why MergeOperation.java in EGit is supplying null to MergeCommand. It looks like one of the mergeCommand.include() invocations included something that has no current ObjectId (e.g. a branch that has not yet been created).
Comment 3 Matthias Sohn CLA 2011-06-16 11:28:23 EDT
This was most probably caused by a non-existing HEAD in the local repository (a freshly created repository has no commit and no HEAD yet). This can't happen anymore since release 0.12 because "Team > Merge..." is disabled if there is no HEAD yet (fixed in egit commit 960dc3ff, included since release 0.12) . 

I tested that merge works properly if there was at least one commit in the local repository before merge is started.