Claus Ibsen created CAMEL-26168:
-----------------------------------
Summary: camel-twitter - twitter-directmessage sends a message
with no text for a null body, and timelineType=public has no consumer
Key: CAMEL-26168
URL: https://issues.apache.org/jira/browse/CAMEL-26168
Project: Camel
Issue Type: Bug
Components: camel-twitter
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of twitter-directmessage,
twitter-search and twitter-timeline (CAMEL-24961, PR #28412).
h4. 1. twitter-directmessage sends a direct message with no text when the body
is null
{{DirectMessageProducer.process}} (main 2a465aa4814c, line 52) reads the text
with {{getBody(String.class)}} and does not check it, so with a null body it
still looks up the user with {{showUser}} and then calls
{{sendDirectMessage(userId, null)}} (line 59). The timeline producer uses
{{getMandatoryBody}} and fails clearly. Checked on 4.24.0-SNAPSHOT with a
Mockito {{twitter4j.Twitter}} on the endpoint: {{sendDirectMessage}} is called
with a null text.
Proposed: use {{getMandatoryBody(String.class)}} (or fail with a clear message)
before the user lookup.
h4. 2. twitter-timeline: timelineType=public is listed but cannot be used
{{TimelineType}} has {{PUBLIC}} and the catalog lists it as a value of
{{timelineType}}, but {{TwitterTimelineEndpoint.createConsumer}} (main
2a465aa4814c, line 94) has no case for it, so a {{twitter-timeline:public}}
consumer fails with "Cannot create any consumer with uri ...". Read in the
code, not run.
Proposed: remove {{PUBLIC}} from the documented values (or give it a consumer
handler), so the catalog only offers timeline types that work.
h4. 3. TwitterConverter.toString(Status) fails with a NullPointerException when
the status has no user
{{TwitterConverter.toString(Status)}} (main 2a465aa4814c, line 37) calls
{{status.getUser().getScreenName()}} without a null check. Checked on
4.24.0-SNAPSHOT with Mockito {{Status}} objects only (a real status normally
has a user), so this is minor.
Proposed: write the status without the user part when {{getUser()}} is null.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)