Skip to content

Commit

Permalink
collapse catch blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Coles committed Apr 19, 2021
1 parent 5f7de25 commit afba928
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ static Document readDocument(final InputStream inputStream) throws ReportAggrega
try {
docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
return docBuilder.parse(inputStream);
} catch (final IOException e) {
throw new ReportAggregationException(e.getMessage(), e);
} catch (final SAXException e) {
throw new ReportAggregationException(e.getMessage(), e);
} catch (final ParserConfigurationException e) {
} catch (final IOException | SAXException | ParserConfigurationException e) {
throw new ReportAggregationException(e.getMessage(), e);
} finally {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public String apply(final ClientClasspathPlugin a) {
try {
return new File(a.getClass().getProtectionDomain().getCodeSource()
.getLocation().toURI()).getCanonicalPath();
} catch (final IOException ex) {
throw createPitErrorForExceptionOnClass(ex, a);
} catch (final URISyntaxException ex) {
} catch (final IOException | URISyntaxException ex) {
throw createPitErrorForExceptionOnClass(ex, a);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ public void run(final List<MutationAnalysisUnit> testUnits) {

try {
processResult(results);
} catch (final InterruptedException e) {
throw Unchecked.translateCheckedException(e);
} catch (final ExecutionException e) {
} catch (final InterruptedException | ExecutionException e) {
throw Unchecked.translateCheckedException(e);
}

Expand Down
8 changes: 1 addition & 7 deletions pitest/src/main/java/org/pitest/boot/HotSwapAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@ public static boolean hotSwap(final Class<?> mutateMe, final byte[] bytes) { //
instrumentation.redefineClasses(definitions);

return true;
} catch (final ClassNotFoundException e) {
// swallow
} catch (final UnmodifiableClassException e) {
// swallow
} catch (final java.lang.VerifyError e) {
// swallow
} catch (final java.lang.InternalError e) {
} catch (final ClassNotFoundException | UnmodifiableClassException | VerifyError | InternalError e) {
// swallow
}
return false;
Expand Down
5 changes: 1 addition & 4 deletions pitest/src/main/java/org/pitest/classinfo/ClassName.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,9 @@ public static Function<ClassName, Stream<Class<?>>> nameToClass(
LOG.warning("Could not load " + className
+ " (NoClassDefFoundError: " + e2.getMessage() + ")");
return Stream.empty();
} catch (final LinkageError e3) {
} catch (final LinkageError | SecurityException e3) {
LOG.warning("Could not load " + className + " " + e3.getMessage());
return Stream.empty();
} catch (final SecurityException e4) {
LOG.warning("Could not load " + className + " " + e4.getMessage());
return Stream.empty();
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ private void executeFutureWithTimeOut(final long maxTime,
final FutureTask<?> future, final ResultCollector rc) {
try {
future.get(maxTime, TimeUnit.MILLISECONDS);
} catch (final TimeoutException ex) {
// swallow
} catch (final InterruptedException e) {
} catch (final TimeoutException | InterruptedException ex) {
// swallow
} catch (final ExecutionException e) {
throw Unchecked.translateCheckedException(e);
Expand Down

0 comments on commit afba928

Please sign in to comment.