diff options
author | Guillaume Nodet <gnodet@gmail.com> | 2014-03-21 15:53:44 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-04-02 00:15:15 +0200 |
commit | 977596b209866d52aee2f12f722403e367bc7ebd (patch) | |
tree | 42bff70414b3c6d9f4ba93c9c177b581d3f17a5c /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java | |
parent | c0574fe680a45a27ca2d278ecb0cc1a1bfd3a440 (diff) | |
download | jgit-977596b209866d52aee2f12f722403e367bc7ebd.tar.gz jgit-977596b209866d52aee2f12f722403e367bc7ebd.zip |
Avoid calls to System.exit() and throw an exception instead
The exception is caught in Main and System.exit() is called.
Bug: 413522
Change-Id: Ibe68f7104d4fd55b832000a7840c07a169e7dd58
Signed-off-by: Guillaume Nodet <gnodet@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java index a2f4060821..f07df1a4b5 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java @@ -54,6 +54,8 @@ package org.eclipse.jgit.pgm; public class Die extends RuntimeException { private static final long serialVersionUID = 1L; + private boolean aborted; + /** * Construct a new message explaining what has gone wrong. * @@ -75,4 +77,25 @@ public class Die extends RuntimeException { public Die(final String why, final Throwable cause) { super(why, cause); } + + /** + * Construct a new exception reflecting the fact that the + * command execution has been aborted before running. + * + * @param aborted boolean indicating the fact the execution has been aborted + * @since 3.4 + */ + public Die(boolean aborted) { + this.aborted = aborted; + } + + /** + * Check if this exception should cause the execution to be aborted. + * + * @return boolean indicating that the execution should be aborted + * @since 3.4 + */ + public boolean isAborted() { + return aborted; + } } |