Skip to content

Commit

Permalink
use multicatch to restrict caught exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Parmet <[email protected]>
  • Loading branch information
andrewparmet committed Oct 6, 2023
1 parent 0da9cb2 commit 77feacc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void testClusterUpdateSettingNonExistent() throws IOException {
try {
openSearchClient.cluster().putSettings(request);
fail();
} catch (Exception e) {
} catch (OpenSearchException | IOException e) {
OpenSearchException openSearchException;
if (e instanceof OpenSearchException) {
openSearchException = (OpenSearchException) e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void testUpdate() throws Exception {
.build();
try {
javaClient().update(updateRequest, AppData.class);
} catch (Exception e) {
} catch (OpenSearchException | IOException e) {
OpenSearchException openSearchException;
if (e instanceof OpenSearchException) {
openSearchException = (OpenSearchException) e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testIndicesExists() throws IOException {
try {
javaClient().indices().get(request);
fail(); // should never execute
} catch (Exception ex) {
} catch (OpenSearchException | IOException ex) {
OpenSearchException openSearchException;
if (ex instanceof OpenSearchException) {
openSearchException = (OpenSearchException) ex;
Expand Down Expand Up @@ -81,7 +81,7 @@ public void testIndicesExists() throws IOException {
try {
javaClient().indices().get(request);
fail(); // should never execute
} catch (Exception ex) {
} catch (OpenSearchException | IOException ex) {
if (!(ex instanceof OpenSearchException)) {
assertTrue(ex.getCause() instanceof OpenSearchException);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public void testGetSettingsNonExistentIndex() throws IOException {
try {
javaClient().indices().getSettings(getIndicesSettingsRequest);
fail();
} catch (Exception ex) {
} catch (OpenSearchException | IOException ex) {
OpenSearchException openSearchException;
if (ex instanceof OpenSearchException) {
openSearchException = (OpenSearchException) ex;
Expand Down Expand Up @@ -201,7 +201,7 @@ public void testDataStream() throws IOException {
try {
javaClient().indices().getDataStream(b -> b.name(dataStreamName));
fail();
} catch (Exception ex) {
} catch (OpenSearchException | IOException ex) {
OpenSearchException openSearchException;
if (ex instanceof OpenSearchException) {
openSearchException = (OpenSearchException) ex;
Expand All @@ -220,7 +220,7 @@ public void testGetNotExistingIndexAlias() throws Exception {
try {
GetAliasResponse response = javaClient().indices().getAlias(aliasRequest);
fail();
} catch (Exception ex) {
} catch (OpenSearchException | IOException ex) {
OpenSearchException openSearchException;
if (ex instanceof OpenSearchException) {
openSearchException = (OpenSearchException) ex;
Expand Down

0 comments on commit 77feacc

Please sign in to comment.