Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 4f8bad7

Browse files
committed
Change to Java 8 catch syntax with multiple exception types
1 parent 88bd640 commit 4f8bad7

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

jmespath-core/src/test/java/io/burt/jmespath/ComplianceRunner.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ private Description createDescription(JmesPathComplianceTest.ComplianceTest<T> c
2929
private Collection<JmesPathComplianceTest.ComplianceTest<T>> getAllTests() {
3030
try {
3131
return testClass.newInstance().getAllTests();
32-
} catch (InstantiationException ie) {
33-
throw new RuntimeException("Could not instantiate runtime", ie);
34-
} catch (IllegalAccessException iae) {
35-
throw new RuntimeException("Could not instantiate runtime", iae);
32+
} catch (InstantiationException | IllegalAccessException e) {
33+
throw new RuntimeException("Could not instantiate runtime", e);
3634
}
3735
}
3836

@@ -42,9 +40,7 @@ public void run(RunNotifier notifier) {
4240
notifier.fireTestStarted(testDescription);
4341
try {
4442
complianceTest.run();
45-
} catch (AssertionError ae) {
46-
notifier.fireTestFailure(new Failure(testDescription, ae));
47-
} catch (Exception e) {
43+
} catch (AssertionError | Exception e) {
4844
notifier.fireTestFailure(new Failure(testDescription, e));
4945
} finally {
5046
notifier.fireTestFinished(testDescription);

jmespath-core/src/test/java/io/burt/jmespath/JmesPathComplianceTest.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,8 @@ public Iterable<String> getFeatureNames() {
137137
}
138138
}
139139
return featureNames;
140-
} catch (IOException ioe) {
141-
throw new RuntimeException("Could not load compliance feature names", ioe);
142-
} catch (URISyntaxException use) {
143-
throw new RuntimeException("Could not load compliance feature names", use);
140+
} catch (IOException | URISyntaxException e) {
141+
throw new RuntimeException("Could not load compliance feature names", e);
144142
}
145143
}
146144

0 commit comments

Comments
 (0)