fix: exit cleanly on failed login in oiecommand#265
Conversation
60fee51 to
7e5b7e5
Compare
|
@dowel015, Thanks for the PR! It looks good to me, but you need to sign your commit to comply with the MPL license of the project. See https://www.secondstate.io/articles/dco/ or the failing check for details. |
|
Be carefull, commit come from claude AI, a licencing problem can appear |
|
This does not look like the right approach to solve the problem. The real question is "why isn't the process ending on its own?" The error path looks like |
5e9f93f to
e530439
Compare
…e#224) new Client(server) creates a JAX-RS client and HTTP connection pool with non-daemon threads. On any failure path (UnauthorizedException, ClientException, or non-SUCCESS login status), client.close() was never called, leaving those threads running and the process hanging. Move client.close() into a finally block — it is idempotent via AtomicBoolean — so it always runs regardless of exit path. Remove System.exit(1) calls that were masking the root cause. Fixes OpenIntegrationEngine#224 Signed-off-by: Joshua Dowell <joshua.dowell@centrallogic.com>
e530439 to
9b5a771
Compare
tonygermano
left a comment
There was a problem hiding this comment.
This is a duplicate of #231
kpalang
left a comment
There was a problem hiding this comment.
Comments formatted as conventional comments.
| } finally { | ||
| if (client != null) { | ||
| client.close(); | ||
| } |
There was a problem hiding this comment.
suggestion: Since Client implements AutoCloseable I would replace the finally clock with a try-with-resources approach.
try (var client = new Client(server)) {|
Closing as duplicate of #231 |
Summary
oiecommandhung indefinitely after a failed login becauseUnauthorizedExceptionwas caught by the genericClientExceptionhandler, which only printed a stack trace and returned — leaving Jersey HTTP client threads alive and the JVM runningUnauthorizedExceptioncatch before the genericClientExceptioncatch that prints a clear"invalid username or password"message and callsSystem.exit(1)ClientExceptionhandler to exit rather than silently return, preventing the same hang for other connection errorsFixes #224
Test plan
oiecommand -a https://localhost:8443 -u admin -p wrongpassword— confirm it prints a clean error and exits immediately with code 1🤖 Generated with Claude Code