davsclaus opened a new pull request, #28946: URL: https://github.com/apache/camel/pull/28946
Fixes [CAMEL-26168](https://issues.apache.org/jira/browse/CAMEL-26168). ### 1. twitter-directmessage sent a direct message with no text for a null body `DirectMessageProducer` read the text with `getBody(String.class)` and did not check it. With a null body it still called `showUser` and then `sendDirectMessage(userId, null)`. Now it reads the text with `getMandatoryBody(String.class)` before the user lookup. A null body fails with `InvalidPayloadException`, and Twitter is not called. This matches the timeline producer. Test: `DirectMessageProducerTest` (Mockito `twitter4j.Twitter`). `nullBodyFailsWithoutSending` failed before the fix. ### 2. timelineType=public was listed but had no consumer `TimelineType` has `PUBLIC` and `UNKNOWN`, and the catalog listed both as values of `timelineType`. Neither has a consumer or a producer: `twitter-timeline:public` fails with "Cannot create any consumer with uri ...". The public timeline handler was removed with the twitter4j 3.0 upgrade (CAMEL-5921), as the Twitter API dropped it. Now `@UriPath(enums = "HOME,USER,MENTIONS,LIST")` lists only the types that work. The component doc already listed only these four. The Java enum is unchanged, so no code that references `TimelineType.PUBLIC` breaks. Test: `TwitterTimelineEndpointTest` reads the endpoint JSON schema. It failed before the fix. ### 3. TwitterConverter.toString(Status) failed when the status has no user It called `status.getUser().getScreenName()` without a null check. Now a status with no user converts to `<createdAt> <text>`, without the screen name. Test: `TwitterConverterTest`. `statusWithoutUserConvertsToText` failed with a NullPointerException before the fix. ### Docs and generated files - `twitter-directmessage-component.adoc`: a message with no body fails. - `@BodyTypes` producer text of twitter-directmessage: "No body fails". - Regenerated the component JSON, the catalog copies (components and docs) and the endpoint DSL (`TwitterTimelineEndpointBuilderFactory`, `StaticEndpointBuilders`). - No upgrade-guide entry: a null body and `timelineType=public` did not work before either. ### Not changed `TwitterConverter.toString(UserList)` has the same unchecked `getUser()` call. A user list always has an owner, so I left it alone. Module unit tests: 19 run, 0 failures (`mvn clean install -Psourcecheck`). The ITs need real Twitter credentials and are skipped. _Claude Code on behalf of Claus Ibsen (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]
