Browse Source

Add possibility to get pure stderr output from AbortedByHookException

This is a preparation for the corresponding EGit change to remove
redundant output in the aborted by commit hook popup.

Bug: 553469
Change-Id: Id5f39a4df659fafc9d951668e6f53fed4380de9d
Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.6
Tim Neumann 5 years ago committed by Matthias Sohn
parent
commit
d1bdfcd0a8
  1. 28
      org.eclipse.jgit/src/org/eclipse/jgit/api/errors/AbortedByHookException.java

28
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/AbortedByHookException.java

@ -66,20 +66,27 @@ public class AbortedByHookException extends GitAPIException {
*/ */
private final int returnCode; private final int returnCode;
/**
* The stderr output of the hook.
*/
private final String hookStdErr;
/** /**
* Constructor for AbortedByHookException * Constructor for AbortedByHookException
* *
* @param message * @param hookStdErr
* The error details. * The error details from the stderr output of the hook
* @param hookName * @param hookName
* The name of the hook that interrupted the command, must not be * The name of the hook that interrupted the command, must not be
* null. * null.
* @param returnCode * @param returnCode
* The return code of the hook process that has been run. * The return code of the hook process that has been run.
*/ */
public AbortedByHookException(String message, String hookName, public AbortedByHookException(String hookStdErr, String hookName,
int returnCode) { int returnCode) {
super(message); super(MessageFormat.format(JGitText.get().commandRejectedByHook,
hookName, hookStdErr));
this.hookStdErr = hookStdErr;
this.hookName = hookName; this.hookName = hookName;
this.returnCode = returnCode; this.returnCode = returnCode;
} }
@ -102,10 +109,13 @@ public class AbortedByHookException extends GitAPIException {
return returnCode; return returnCode;
} }
/** {@inheritDoc} */ /**
@Override * Get the stderr output of the hook.
public String getMessage() { *
return MessageFormat.format(JGitText.get().commandRejectedByHook, * @return A string containing the complete stderr output of the hook.
hookName, super.getMessage()); * @since 5.6
*/
public String getHookStdErr() {
return hookStdErr;
} }
} }

Loading…
Cancel
Save