Browse Source

Handle null in ProgressMonitor setters

These commands' monitor fields can never be null unless someone passes
null to setProgressMonitor.  Anyone passing null probably meant to
disable the ProgressMonitor, so do that (by falling back to
NullProgressMonitor.INSTANCE) instead of saving a null and eventually
producing NullPointerException.

Change-Id: I63ad93ea8ad669fd333a5fd40880e7583ba24827
Signed-off-by: Jonathan Nieder <jrn@google.com>
stable-4.1
Jonathan Nieder 10 years ago
parent
commit
bbfd9b0e5f
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
  2. 3
      org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
  3. 3
      org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
  4. 3
      org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
  5. 3
      org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
  6. 3
      org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

3
org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java

@ -432,6 +432,9 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
* @return {@code this}
*/
public CloneCommand setProgressMonitor(ProgressMonitor monitor) {
if (monitor == null) {
monitor = NullProgressMonitor.INSTANCE;
}
this.monitor = monitor;
return this;
}

3
org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java

@ -268,6 +268,9 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> {
* @return this instance
*/
public DiffCommand setProgressMonitor(ProgressMonitor monitor) {
if (monitor == null) {
monitor = NullProgressMonitor.INSTANCE;
}
this.monitor = monitor;
return this;
}

3
org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java

@ -244,6 +244,9 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
*/
public FetchCommand setProgressMonitor(ProgressMonitor monitor) {
checkCallable();
if (monitor == null) {
monitor = NullProgressMonitor.INSTANCE;
}
this.monitor = monitor;
return this;
}

3
org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java

@ -130,6 +130,9 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
* @return this instance
*/
public PullCommand setProgressMonitor(ProgressMonitor monitor) {
if (monitor == null) {
monitor = NullProgressMonitor.INSTANCE;
}
this.monitor = monitor;
return this;
}

3
org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java

@ -257,6 +257,9 @@ public class PushCommand extends
*/
public PushCommand setProgressMonitor(ProgressMonitor monitor) {
checkCallable();
if (monitor == null) {
monitor = NullProgressMonitor.INSTANCE;
}
this.monitor = monitor;
return this;
}

3
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

@ -1493,6 +1493,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
* @return this instance
*/
public RebaseCommand setProgressMonitor(ProgressMonitor monitor) {
if (monitor == null) {
monitor = NullProgressMonitor.INSTANCE;
}
this.monitor = monitor;
return this;
}

Loading…
Cancel
Save