Skip to content

Commit 60fee51

Browse files
Joshua Dowellclaude
andcommitted
fix: exit cleanly on failed login in oiecommand (#224)
UnauthorizedException was caught by the generic ClientException handler which only printed a stack trace and returned, leaving Jersey HTTP client threads running and the process hanging indefinitely. Catch UnauthorizedException before ClientException, print a clear "invalid username or password" message, and call System.exit(1) so the process terminates. Also exit on other ClientExceptions rather than swallowing them silently. Fixes #224 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 19cd7aa commit 60fee51

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

command/src/com/mirth/connect/cli/CommandLineInterface.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import com.mirth.connect.client.core.BrandingConstants;
5757
import com.mirth.connect.client.core.Client;
5858
import com.mirth.connect.client.core.ClientException;
59+
import com.mirth.connect.client.core.UnauthorizedException;
5960
import com.mirth.connect.client.core.ListHandlerException;
6061
import com.mirth.connect.client.core.PaginatedEventList;
6162
import com.mirth.connect.client.core.PaginatedMessageList;
@@ -218,8 +219,12 @@ private void runShell(String server, String user, String password, String script
218219
client.logout();
219220
client.close();
220221
out.println("Disconnected from server.");
222+
} catch (UnauthorizedException ue) {
223+
error("Could not login to server: invalid username or password.", null);
224+
System.exit(1);
221225
} catch (ClientException ce) {
222-
ce.printStackTrace();
226+
error("A client error occurred.", ce);
227+
System.exit(1);
223228
} catch (IOException ioe) {
224229
error("Could not load script file.", ioe);
225230
} catch (URISyntaxException e) {

0 commit comments

Comments
 (0)