Skip to content

Commit

Permalink
Use Multi-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
dbwiddis committed Nov 21, 2023
1 parent c23851e commit c8ef506
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ public void run() {

executor.shutdown();

} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
} catch (TimeoutException e) {
executor.shutdownNow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ public IRunningObjectTable getRunningObjectTable() {
private <T> T runInComThread(Callable<T> callable) {
try {
return comThread.execute(callable);
} catch (TimeoutException ex) {
throw new RuntimeException(ex);
} catch (InterruptedException ex) {
} catch (TimeoutException | InterruptedException ex) {
throw new RuntimeException(ex);
} catch (ExecutionException ex) {
Throwable cause = ex.getCause();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1942,9 +1942,7 @@ public static class DdemlException extends RuntimeException {
if (name.startsWith("DMLERR_") && (!name.equals("DMLERR_FIRST")) && (!name.equals("DMLERR_LAST"))) {
try {
errorCodeMapBuilder.put(f.getInt(null), name);
} catch (IllegalArgumentException ex) {
throw new RuntimeException(ex);
} catch (IllegalAccessException ex) {
} catch (IllegalArgumentException | IllegalAccessException ex) {
throw new RuntimeException(ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ void addSuppressedReflected(Throwable exception) {
}
try {
addSuppressedMethod.invoke(this, exception);
} catch (IllegalAccessException ex) {
throw new RuntimeException("Failed to call addSuppressedMethod", ex);
} catch (IllegalArgumentException ex) {
throw new RuntimeException("Failed to call addSuppressedMethod", ex);
} catch (InvocationTargetException ex) {
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
throw new RuntimeException("Failed to call addSuppressedMethod", ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ public void testRegisterHotKey() {
robot.keyRelease(vk);
msg = waitForMessage(500);
assertNull(msg);
} catch (AWTException e) {
e.printStackTrace();
fail();
} catch (InterruptedException e) {
} catch (AWTException | InterruptedException e) {
e.printStackTrace();
fail();
} finally {
Expand Down

0 comments on commit c8ef506

Please sign in to comment.