Andrea Cosentino created CAMEL-26518:
----------------------------------------

             Summary: camel-alibaba-oss - the consumer polls before its client 
is set, so the first poll can fail with a NullPointerException
                 Key: CAMEL-26518
                 URL: https://issues.apache.org/jira/browse/CAMEL-26518
             Project: Camel
          Issue Type: Bug
            Reporter: Andrea Cosentino


Found while fixing CAMEL-26261 ([PR 
#28952|https://github.com/apache/camel/pull/28952]).

{{OSSConsumer.doStart()}} calls {{super.doStart()}}, which starts the scheduled 
polling, before it sets the {{ossClient}} field ({{this.ossClient = 
this.endpoint.initClient()}}). With {{initialDelay=0}} the first poll can run 
before the client is set and fails with a {{NullPointerException}} 
("this.ossClient is null"). The scheduled consumer logs it as a WARN and the 
next poll works, so it shows as a spurious warning at startup (it also shows in 
the module tests).

Proposed: create the client before {{super.doStart()}} (or in {{doInit()}}), 
and check the bucket name before polling starts too.

_Claude Code on behalf of Andrea Cosentino (oscerd)_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to