aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
authorCarsten Hammer <carsten.hammer@t-online.de>2019-04-06 18:16:21 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-04-13 18:53:58 +0200
commitc0268f899e3e600a45f6c028f4d0088b2fb2fce1 (patch)
treea017363ab828ae957cfa1f0c4ce8f72e268b0139 /org.eclipse.jgit.pgm/src
parent3c1af2761f91ec7c17b648c0537e6c7f1847032e (diff)
downloadjgit-c0268f899e3e600a45f6c028f4d0088b2fb2fce1.tar.gz
jgit-c0268f899e3e600a45f6c028f4d0088b2fb2fce1.zip
Join catch sections using multicatch
Change-Id: I1a9112e6a4f938638c599b489cb0858eca27ab91 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java6
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java19
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java20
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java5
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java5
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java5
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java5
8 files changed, 18 insertions, 51 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
index dbdccc10e2..b98bf151a5 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
@@ -163,13 +163,9 @@ public class CommandCatalog {
final Class<? extends TextBuiltin> clazz;
try {
clazz = Class.forName(cn, false, ldr).asSubclass(TextBuiltin.class);
- } catch (ClassNotFoundException notBuiltin) {
+ } catch (ClassNotFoundException | ClassCastException notBuiltin) {
// Doesn't exist, even though the service entry is present.
- //
- return;
- } catch (ClassCastException notBuiltin) {
// Isn't really a builtin, even though its listed as such.
- //
return;
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java
index 1773de5d78..85ace3a077 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java
@@ -156,24 +156,19 @@ public class CommandRef {
final Constructor<? extends TextBuiltin> c;
try {
c = impl.getDeclaredConstructor();
- } catch (SecurityException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
+ } catch (SecurityException | NoSuchMethodException e) {
+ throw new RuntimeException(MessageFormat
+ .format(CLIText.get().cannotCreateCommand, getName(), e));
}
c.setAccessible(true);
final TextBuiltin r;
try {
r = c.newInstance();
- } catch (InstantiationException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
- } catch (IllegalAccessException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
- } catch (InvocationTargetException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
+ } catch (InstantiationException | IllegalAccessException
+ | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(MessageFormat
+ .format(CLIText.get().cannotCreateCommand, getName(), e));
}
r.setCommandName(getName());
return r;
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
index 0373aeff58..9952f5cfc1 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
@@ -330,22 +330,12 @@ public class Main {
install("org.eclipse.jgit.console.ConsoleAuthenticator"); //$NON-NLS-1$
install("org.eclipse.jgit.console.ConsoleCredentialsProvider"); //$NON-NLS-1$
return true;
- } catch (ClassNotFoundException e) {
+ } catch (ClassNotFoundException | NoClassDefFoundError
+ | UnsupportedClassVersionError e) {
return false;
- } catch (NoClassDefFoundError e) {
- return false;
- } catch (UnsupportedClassVersionError e) {
- return false;
-
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
- } catch (SecurityException e) {
- throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
- } catch (NoSuchMethodException e) {
+ } catch (IllegalArgumentException | SecurityException
+ | IllegalAccessException | InvocationTargetException
+ | NoSuchMethodException e) {
throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
}
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
index 0e1b398a73..6165c0aeed 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
@@ -338,12 +338,9 @@ class DiffAlgorithms extends TextBuiltin {
}
}
}
- } catch (IllegalArgumentException e) {
- throw die("Cannot determine names", e); //$NON-NLS-1$
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw die("Cannot determine names", e); //$NON-NLS-1$
}
-
return all;
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
index 300a01d246..a2ea8c20b4 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
@@ -403,9 +403,7 @@ class TextHashFunctions extends TextBuiltin {
folds.add(fold);
}
}
- } catch (IllegalArgumentException e) {
- throw new RuntimeException("Cannot determine names", e); //$NON-NLS-1$
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException("Cannot determine names", e); //$NON-NLS-1$
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
index a14f6514fe..213d9875db 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
@@ -133,10 +133,7 @@ public class AbstractTreeIteratorHandler extends
final CanonicalTreeParser p = new CanonicalTreeParser();
try (ObjectReader curs = clp.getRepository().newObjectReader()) {
p.reset(curs, clp.getRevWalk().parseTree(id));
- } catch (MissingObjectException e) {
- throw new CmdLineException(clp,
- CLIText.format(CLIText.get().notATree), name);
- } catch (IncorrectObjectTypeException e) {
+ } catch (MissingObjectException | IncorrectObjectTypeException e) {
throw new CmdLineException(clp,
CLIText.format(CLIText.get().notATree), name);
} catch (IOException e) {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java
index b925e31f85..d4effa3a10 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java
@@ -130,10 +130,7 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
final RevCommit c;
try {
c = clp.getRevWalk().parseCommit(id);
- } catch (MissingObjectException e) {
- throw new CmdLineException(clp,
- CLIText.format(CLIText.get().notACommit), name);
- } catch (IncorrectObjectTypeException e) {
+ } catch (MissingObjectException | IncorrectObjectTypeException e) {
throw new CmdLineException(clp,
CLIText.format(CLIText.get().notACommit), name);
} catch (IOException e) {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java
index 85922a27ba..19841f633a 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java
@@ -102,10 +102,7 @@ public class RevTreeHandler extends OptionHandler<RevTree> {
final RevTree c;
try {
c = clp.getRevWalk().parseTree(id);
- } catch (MissingObjectException e) {
- throw new CmdLineException(clp,
- CLIText.format(CLIText.get().notATree), name);
- } catch (IncorrectObjectTypeException e) {
+ } catch (MissingObjectException | IncorrectObjectTypeException e) {
throw new CmdLineException(clp,
CLIText.format(CLIText.get().notATree), name);
} catch (IOException e) {