summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-01-21 23:44:20 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-01-21 23:44:20 +0100
commit5ca4075c450acf70481caa664d70993f0611b782 (patch)
treeb1fa7b6a16649af6ce90ed55cdcc0058ef221d6f /org.eclipse.jgit.pgm/src/org
parent390fe5b878b98682936acf27a2e1499d8695fbca (diff)
downloadjgit-5ca4075c450acf70481caa664d70993f0611b782.tar.gz
jgit-5ca4075c450acf70481caa664d70993f0611b782.zip
pgm: Handle IOException in ShowRef command
This avoids we show a stacktrace on the console by default when this type of exception is thrown during the run method is executed. Change-Id: If18a5d8013f1cb393af3a5e5a1ec9613ac2151bd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
index 6318a633ca..d319759ed7 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
@@ -56,15 +56,19 @@ import org.eclipse.jgit.lib.RefComparator;
class ShowRef extends TextBuiltin {
/** {@inheritDoc} */
@Override
- protected void run() throws Exception {
- for (Ref r : getSortedRefs()) {
- show(r.getObjectId(), r.getName());
- if (r.getPeeledObjectId() != null)
- show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$
+ protected void run() {
+ try {
+ for (Ref r : getSortedRefs()) {
+ show(r.getObjectId(), r.getName());
+ if (r.getPeeledObjectId() != null)
+ show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$
+ }
+ } catch (IOException e) {
+ throw die(e.getMessage(), e);
}
}
- private Iterable<Ref> getSortedRefs() throws Exception {
+ private Iterable<Ref> getSortedRefs() throws IOException {
List<Ref> all = db.getRefDatabase().getRefs();
// TODO(jrn) check if we can reintroduce fast-path by e.g. implementing
// SortedList