Community
Participate
Working Groups
Hi issuing a pull command in jgit-1.0.0.201106090707-r leads to NPE: Caused by: java.lang.NullPointerException at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:149) The source is like this: public PullResult call() throws WrongRepositoryStateException, InvalidConfigurationException, DetachedHeadException, InvalidRemoteException, CanceledException, RefNotFoundException { checkCallable(); monitor.beginTask(JGitText.get().pullTaskName, 2); String branchName; try { String fullBranch = repo.getFullBranch(); [149] if (!fullBranch.startsWith(Constants.R_HEADS)) { ... Let's look into method getFullBranch(): public String getFullBranch() throws IOException { Ref head = getRef(Constants.HEAD); if (head == null) return null; if (head.isSymbolic()) return head.getTarget().getName(); if (head.getObjectId() != null) return head.getObjectId().name(); return null; } Obviously getFullBranch() can return null in which case fullBranch.startsWith() will throw a NPE. Best Regards Udo
I think the exception is thrown when the Git object is created from a FileRepository instance that points to the work-dir folder instead of the .git folder inside. So an illegal argument is causing this problem. But IMHO a better explanation would be helpful. Regards Udo
Proposed fix pushed to: http://egit.eclipse.org/r/4668
Merged to master as commit c3fe50bb18ed4e4e5e563172be4076fa5901a18a
Marking fixed in 1.2.0