Skip to content

CAMEL-23615: camel-tui - Fix unsafe type casts and unguarded parsing#23547

Merged
davsclaus merged 1 commit into
mainfrom
CAMEL-23615-tui-polish
May 27, 2026
Merged

CAMEL-23615: camel-tui - Fix unsafe type casts and unguarded parsing#23547
davsclaus merged 1 commit into
mainfrom
CAMEL-23615-tui-polish

Conversation

@davsclaus
Copy link
Copy Markdown
Contributor

Summary

  • Fix unsafe (Boolean) cast from JSON for polling field — use Boolean.TRUE.equals() instead
  • Fix unsafe (Boolean) casts for done/failed fields in history entry parsing
  • Guard Long.parseLong(ctx.selectedPid) with try-catch on tab switch to history

Test plan

  • Builds clean
  • Manual: TUI operates normally with consumer tab, history tab, and endpoint views

Claude Code on behalf of Claus Ibsen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions github-actions Bot added the dsl label May 27, 2026
Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good defensive coding fixes for the TUI:

  1. Wrapping Long.parseLong(ctx.selectedPid) in try-catch for NumberFormatException — prevents crash on unexpected PID values.
  2. Replacing unsafe (Boolean) json.get("done") / (Boolean) json.get("failed") casts with Boolean.TRUE.equals(...) — avoids ClassCastException if the JSON value isn't a Boolean object.
  3. Same fix for cj.get("polling") in parseIntegration.

All three changes follow the same pattern: replacing unsafe assumptions about runtime types with null-safe, cast-safe alternatives.

LGTM.

Fully automatic review from Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-plugin-tui
All tested modules (2 modules)
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: Launcher :: Container

⚙️ View full build and test results

@davsclaus davsclaus merged commit d389fcd into main May 27, 2026
6 checks passed
@davsclaus davsclaus deleted the CAMEL-23615-tui-polish branch May 27, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants