mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
git4idea: Ensuring that either exception is thrown or non-null stdout is returned from GitSimpleHandler.run()
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user