svn: Do not handle possible authentication errors (from process output) if command was manually cancelled

This commit is contained in:
Konstantin Kolosovsky
2013-11-12 21:37:31 +04:00
parent 9fe9708322
commit 8c751bed46
2 changed files with 12 additions and 8 deletions
@@ -45,6 +45,7 @@ public class CommandExecutor {
private boolean myIsDestroyed;
private boolean myNeedsDestroy;
private volatile String myDestroyReason;
private volatile boolean myWasCancelled;
protected final GeneralCommandLine myCommandLine;
protected Process myProcess;
protected OSProcessHandler myHandler;
@@ -181,7 +182,7 @@ public class CommandExecutor {
boolean finished;
do {
finished = waitFor(500);
if (!finished && (wasError() || needsDestroy() || wasCancelled())) {
if (!finished && (wasError() || needsDestroy() || checkCancelled())) {
waitFor(1000);
doDestroyProcess();
break;
@@ -204,20 +205,22 @@ public class CommandExecutor {
}
}
private boolean wasCancelled() {
boolean result = false;
if (myCommand.getCanceller() != null) {
private boolean checkCancelled() {
if (!myWasCancelled && myCommand.getCanceller() != null) {
try {
myCommand.getCanceller().checkCancelled();
}
catch (SVNCancelException e) {
// indicates command should be cancelled
result = true;
myWasCancelled = true;
}
}
return result;
return myWasCancelled;
}
public boolean wasCancelled() {
return myWasCancelled;
}
public void destroyProcess() {
@@ -105,7 +105,8 @@ public class CommandRuntime {
// handle authentication
final String errText = executor.getErrorOutput().trim();
final AuthCallbackCase callback = executor instanceof TerminalExecutor ? null : createCallback(errText, command.getRepositoryUrl());
if (callback != null) {
// do not handle possible authentication errors if command was manually cancelled
if (!executor.wasCancelled() && callback != null) {
if (callback.getCredentials(errText)) {
if (myAuthCallback.getSpecialConfigDir() != null) {
command.setConfigDir(myAuthCallback.getSpecialConfigDir());