Coverity 72994

This commit is contained in:
Sebastian Stenzel
2016-03-04 17:56:02 +01:00
parent bae826be28
commit 9117b6bc0e

View File

@@ -30,6 +30,7 @@ public final class CommandResult {
/**
* Constructs a CommandResult from a terminated process and closes all its streams.
*
* @param process An <strong>already finished</strong> process.
*/
CommandResult(Process process) {
@@ -52,7 +53,7 @@ public final class CommandResult {
logDebugInfo();
}
}
/**
* @return Data written to STDOUT
*/
@@ -94,10 +95,10 @@ public final class CommandResult {
assertNoException();
int exitValue = getExitValue();
if (exitValue != 0) {
throw new CommandFailedException(format("Command execution failed. Exit code: %d\n" + "# Output:\n" + "%s\n" + "# Error:\n" + "%s", exitValue, stdout, stderr));
throw new CommandFailedException(format("Command execution failed. Exit code: %d %n# Output:%n%s %n# Error: %n%s", exitValue, stdout, stderr));
}
}
private void assertNoException() throws CommandFailedException {
if (exception != null) {
throw exception;