diff --git a/plugins/git4idea/src/git4idea/commands/GitSimpleHandler.java b/plugins/git4idea/src/git4idea/commands/GitSimpleHandler.java index 3cbf8b19cd49..98498c575173 100644 --- a/plugins/git4idea/src/git4idea/commands/GitSimpleHandler.java +++ b/plugins/git4idea/src/git4idea/commands/GitSimpleHandler.java @@ -192,18 +192,23 @@ public class GitSimpleHandler extends GitHandler { final String[] result = new String[1]; addListener(new GitHandlerListener() { public void processTerminated(final int exitCode) { - if (exitCode == 0 || isIgnoredErrorCode(exitCode)) { - result[0] = getStdout(); + try { + if (exitCode == 0 || isIgnoredErrorCode(exitCode)) { + result[0] = getStdout(); + } + else { + String msg = getStderr(); + if (msg.length() == 0) { + msg = getStdout(); + } + if (msg.length() == 0) { + msg = GitBundle.message("git.error.exit", exitCode); + } + ex[0] = new VcsException(msg); + } } - else { - String msg = getStderr(); - if (msg.length() == 0) { - msg = getStdout(); - } - if (msg.length() == 0) { - msg = GitBundle.message("git.error.exit", exitCode); - } - ex[0] = new VcsException(msg); + catch (Exception t) { + ex[0] = new VcsException(t.toString(), t); } } diff --git a/plugins/git4idea/src/git4idea/commands/StringScanner.java b/plugins/git4idea/src/git4idea/commands/StringScanner.java index 47e3d485101e..86d6440f83a3 100644 --- a/plugins/git4idea/src/git4idea/commands/StringScanner.java +++ b/plugins/git4idea/src/git4idea/commands/StringScanner.java @@ -15,6 +15,8 @@ */ package git4idea.commands; +import org.jetbrains.annotations.NotNull; + /** * A parser of strings that is oriented to scanning typical git outputs */ @@ -33,7 +35,7 @@ public class StringScanner { * * @param text the text to scan */ - public StringScanner(final String text) { + public StringScanner(@NotNull final String text) { myText = text; myPosition = 0; }