Skip to content

Commit 862090e

Browse files
author
Yogesh Gaikwad
committed
CLI: MultiCommand#close address review comments
Closes elastic#28953
1 parent 91d785e commit 862090e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/test/java/org/elasticsearch/cli/MultiCommandTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static class DummyMultiCommand extends MultiCommand {
4040
public void close() throws IOException {
4141
super.close();
4242
if (this.closed.compareAndSet(false, true) == false) {
43-
throw new IOException("DummyMultiCommand already closed");
43+
throw new IllegalStateException("DummyMultiCommand already closed");
4444
}
4545
}
4646
}
@@ -67,7 +67,7 @@ protected void execute(Terminal terminal, OptionSet options) throws Exception {
6767
@Override
6868
public void close() throws IOException {
6969
if (this.closeCalled.compareAndSet(false, true) == false) {
70-
throw new IOException("DummySubCommand already closed");
70+
throw new IllegalStateException("DummySubCommand already closed");
7171
}
7272
if (throwsExceptionOnClose) {
7373
throw new IOException("Error occurred while closing DummySubCommand");
@@ -172,4 +172,5 @@ public void testCloseWhenSubCommandCloseThrowsException() throws Exception {
172172
assertTrue("SubCommand1 was not closed when close method is invoked", subCommand1.closeCalled.get());
173173
assertTrue("SubCommand2 was not closed when close method is invoked", subCommand2.closeCalled.get());
174174
}
175+
175176
}

0 commit comments

Comments
 (0)