diff options
| author | Endi S. Dewata <edewata@redhat.com> | 2016-07-06 21:12:35 +0200 |
|---|---|---|
| committer | Endi S. Dewata <edewata@redhat.com> | 2016-07-06 21:18:20 +0200 |
| commit | 4bdb8793eddd8d6c26a08c8f871249aa9a5bde7a (patch) | |
| tree | 7df6c4d2b0101960df6eededf1aa1a9b731ada20 /base/java-tools/src | |
| parent | 03926918b688d6634a46e322565bd1ab8ccdd811 (diff) | |
| download | pki-4bdb8793eddd8d6c26a08c8f871249aa9a5bde7a.tar.gz pki-4bdb8793eddd8d6c26a08c8f871249aa9a5bde7a.tar.xz pki-4bdb8793eddd8d6c26a08c8f871249aa9a5bde7a.zip | |
Fixed CLI error message on connection problems
The CLI has been modified to display the actual error message
instead of generic ProcessingException.
https://fedorahosted.org/pki/ticket/2377
Diffstat (limited to 'base/java-tools/src')
| -rw-r--r-- | base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java index 797f3cb03..8f3293dea 100644 --- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java @@ -31,6 +31,8 @@ import java.net.UnknownHostException; import java.util.Collection; import java.util.HashSet; +import javax.ws.rs.ProcessingException; + import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.lang.StringUtils; @@ -571,11 +573,20 @@ public class MainCLI extends CLI { MainCLI cli = new MainCLI(); cli.execute(args); + } catch (ProcessingException e) { + Throwable t = e.getCause(); + if (verbose) { + t.printStackTrace(System.err); + } else { + System.err.println(t.getClass().getSimpleName() + ": " + t.getMessage()); + } + System.exit(-1); + } catch (Throwable t) { if (verbose) { t.printStackTrace(System.err); } else { - System.err.println(t.getClass().getSimpleName()+": "+t.getMessage()); + System.err.println(t.getClass().getSimpleName() + ": " + t.getMessage()); } System.exit(-1); } |
