davsclaus opened a new pull request, #29908:
URL: https://github.com/apache/camel/pull/29908

   Item 1 of [CAMEL-26929](https://issues.apache.org/jira/browse/CAMEL-26929).
   
   ## Problem
   
   `camel get consumer` and `camel get producer` fail with exit 70 on any 
integration that has a consumer or producer:
   
   ```
   $ camel get consumer --json
   {"status":"error","code":70,"message":"Cannot invoke 
\"String.endsWith(String)\" because \"s\" is null"}
   ```
   
   Since CAMEL-24565 (Camel 4.23) the consumer and producer dev consoles are 
records. Their key for the class is `clazz`, and a hosted service is `hosted`. 
`ListConsumer` and `ListProducer` still read `class` and `hostedService`, get 
null, and `getType` fails. The TUI was fixed at the time (`StatusParser`); the 
CLI was not. The tests passed because their fixtures wrote the old keys by hand.
   
   ## Change
   
   - `ListConsumer` and `ListProducer` read `clazz` / `hosted`. If those are 
missing they fall back to `class` / `hostedService`, so the CLI keeps working 
against integrations on Camel 4.22 and older. This is the same rule 
`StatusParser` uses.
   - `getType` returns an empty type when there is no class, instead of failing.
   - The test fixtures are now built from `ConsumerDevConsole.ConsumerEntry` / 
`ProducerDevConsole.ProducerEntry` with `JsonRecordSupport`, so renaming a 
console key breaks a test. Each command gets a new test for the old keys.
   
   I also checked the other console keys CAMEL-24565 removed against every key 
the CLI reads. `clazz` and `hosted` are the only renamed keys the CLI depends 
on.
   
   ## Tests
   
   `ListConsumerTest` and `ListProducerTest`: 11 tests. Without the fix, 7 of 
them fail with the NullPointerException above; with the fix all pass.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to