diff options
author | Sasa Zivkov <sasa.zivkov@sap.com> | 2011-01-26 17:28:47 +0100 |
---|---|---|
committer | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-01-26 11:38:59 -0600 |
commit | 65680da3ee2e423dd400c4ffc4195c4cf98ab77b (patch) | |
tree | 076a08871c30d77fb82fe5343e063b1afbc19325 /org.eclipse.jgit.pgm | |
parent | 990498b75d3d3955b629a48e5f39dd09bc7a3116 (diff) | |
download | jgit-65680da3ee2e423dd400c4ffc4195c4cf98ab77b.tar.gz jgit-65680da3ee2e423dd400c4ffc4195c4cf98ab77b.zip |
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>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java index e2467b2c3e..f100390e4e 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java @@ -93,13 +93,18 @@ class Fetch extends AbstractFetchCommand { protected void run() throws Exception { Git git = new Git(db); FetchCommand fetch = git.fetch(); - fetch.setCheckFetchedObjects(fsck.booleanValue()); - fetch.setRemoveDeletedRefs(prune.booleanValue()); - fetch.setRefSpecs(toget); - fetch.setTimeout(timeout); + if (fsck != null) + fetch.setCheckFetchedObjects(fsck.booleanValue()); + if (prune != null) + fetch.setRemoveDeletedRefs(prune.booleanValue()); + if (toget != null) + fetch.setRefSpecs(toget); + if (0 <= timeout) + fetch.setTimeout(timeout); fetch.setDryRun(dryRun); fetch.setRemote(remote); - fetch.setThin(thin.booleanValue()); + if (thin != null) + fetch.setThin(thin.booleanValue()); fetch.setProgressMonitor(new TextProgressMonitor()); FetchResult result = fetch.call(); |