Browse Source

Fixed several NPEs in the Fetch CLI

The Fetch command line was failing with NPE in case some options were omitted.
Additionally, it was setting a negative timeout when no timeout option was used
which caused HttpURLConnection to throw an IllegalArgumentException.

Change-Id: I2c67e2e1a03044284d183d73f0b82bb7ff79de95
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
stable-0.11
Sasa Zivkov 14 years ago committed by Chris Aniszczyk
parent
commit
65680da3ee
  1. 5
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java

5
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java

@ -93,12 +93,17 @@ class Fetch extends AbstractFetchCommand {
protected void run() throws Exception { protected void run() throws Exception {
Git git = new Git(db); Git git = new Git(db);
FetchCommand fetch = git.fetch(); FetchCommand fetch = git.fetch();
if (fsck != null)
fetch.setCheckFetchedObjects(fsck.booleanValue()); fetch.setCheckFetchedObjects(fsck.booleanValue());
if (prune != null)
fetch.setRemoveDeletedRefs(prune.booleanValue()); fetch.setRemoveDeletedRefs(prune.booleanValue());
if (toget != null)
fetch.setRefSpecs(toget); fetch.setRefSpecs(toget);
if (0 <= timeout)
fetch.setTimeout(timeout); fetch.setTimeout(timeout);
fetch.setDryRun(dryRun); fetch.setDryRun(dryRun);
fetch.setRemote(remote); fetch.setRemote(remote);
if (thin != null)
fetch.setThin(thin.booleanValue()); fetch.setThin(thin.booleanValue());
fetch.setProgressMonitor(new TextProgressMonitor()); fetch.setProgressMonitor(new TextProgressMonitor());

Loading…
Cancel
Save