refactor(exception): Reverted changes to ExecutableFailedException.
package com.synopsys.integration.detectable.detectable.executable;
-import org.apache.commons.lang3.StringUtils;
-import org.jetbrains.annotations.Nullable;
-
import com.synopsys.integration.executable.Executable;
import com.synopsys.integration.executable.ExecutableOutput;
import com.synopsys.integration.executable.ExecutableRunnerException;
@@ -14,32 +11,19 @@ public class ExecutableFailedException extends Exception {
private final ExecutableRunnerException executableException;
public ExecutableFailedException(Executable executable, ExecutableRunnerException executableException) {
- this(executable, executableException, null);
- }
-
- public ExecutableFailedException(Executable executable, ExecutableRunnerException executableException, @Nullable String additionalFailureMessage) {
- super(createPrettyMessage("An exception occurred running an executable.", additionalFailureMessage), executableException);
+ super("An exception occurred running an executable.", executableException);
this.executableException = executableException;
this.returnCode = 0;
this.executableDescription = executable.getExecutableDescription();
}
public ExecutableFailedException(Executable executable, ExecutableOutput executableOutput) {
- this(executable, executableOutput, null);
- }
-
- public ExecutableFailedException(Executable executable, ExecutableOutput executableOutput, @Nullable String additionalFailureMessage) {
- super(createPrettyMessage("An executable returned a non-zero exit code: " + executableOutput.getReturnCode(), additionalFailureMessage));
+ super("An executable returned a non-zero exit code: " + executableOutput.getReturnCode());
this.returnCode = executableOutput.getReturnCode();
this.executableDescription = executable.getExecutableDescription();
executableException = null;
}
- private static String createPrettyMessage(String message, @Nullable String additionalFailureMessage) {
- String prettyMessage = String.format("%s %s", message, StringUtils.trimToEmpty(additionalFailureMessage));
- return StringUtils.trim(prettyMessage);
- }
-
public boolean hasReturnCode() {
return returnCode != 0;
}
