[ 
https://issues.apache.org/jira/browse/CAMEL-25281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18122173#comment-18122173
 ] 

Claus Ibsen commented on CAMEL-25281:
-------------------------------------

Merged via https://github.com/apache/camel/pull/27310

_Claude Code on behalf of davsclaus_

> camel-pubnub - an endpoint without its own PubNub client fails to start 
> unless publishKey, secretKey and authKey are all set ("Parameter specified as 
> non-null is null")
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25281
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25281
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-pubnub
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Minor
>             Fix For: 4.23.0
>
>
> When no PubNub client is given (no {{pubnub}} bean to autowire, no 
> {{pubnub=#bean}}), {{PubNubEndpoint.doStart}} builds one from the endpoint 
> options:
> {code:java}
> PNConfiguration.builder(new UserId(configuration.getUuid()), 
> configuration.getSubscribeKey())
>         .publishKey(configuration.getPublishKey())
>         .secretKey(configuration.getSecretKey())
>         .authKey(configuration.getAuthKey())
>         .secure(configuration.isSecure()).build();
> {code}
> The builder of the PubNub Java SDK (Kotlin) rejects {{null}} in these 
> setters, so an endpoint that does not set all three keys fails to start:
> {noformat}
> ResolveEndpointFailed Failed to resolve endpoint: 
> pubnub://xxx?subscribeKey=xxxxxx&uuid=myuuid due to:
> Parameter specified as non-null is null: method 
> com.pubnub.internal.java.v2.PNConfigurationImpl$Builder.publishKey, parameter 
> publishKey
> {noformat}
> But {{publishKey}} is only needed to publish, {{secretKey}} is a server-side 
> key that clients should not have, and {{authKey}} is deprecated (PAM v2). So 
> an endpoint with the options a subscriber needs ({{subscribeKey}} and the 
> required {{uuid}}), or a publisher without the secret key, does not start; 
> only a user who supplies a client bean, or sets all keys (including the 
> server-side {{secretKey}} and the deprecated {{authKey}}), gets a working 
> endpoint. (The examples in the component documentation also leave out the 
> required {{uuid}}, so they fail earlier, on {{new UserId(null)}}, with or 
> without this fix.) The component tests all use a client bean, so they did not 
> notice. The builder code came with the upgrade to the PubNub 10 client 
> (17cdc892ee, Camel 4.9); before, the endpoint used the setters of the old 
> {{PNConfiguration}}.
> h3. Reproduction
> {{PubNubConfigurationTest}}: 
> {{context.getEndpoint("pubnub:xxx?subscribeKey=mysubkey&uuid=myuuid")}} fails 
> with the error above ({{publishKey}}); with {{publishKey}} set it fails on 
> {{secretKey}}. Checked against the SDK (13.4.4) directly: 
> {{publishKey(null)}}, {{secretKey(null)}} and {{authKey(null)}} all throw.
> h3. Proposed fix
> Call the three setters only for the keys that are configured; the builder's 
> defaults apply to the others. New tests in {{PubNubConfigurationTest}}: an 
> endpoint with only {{subscribeKey}} and {{uuid}}, one with a {{publishKey}}, 
> one with all keys (the first two fail on main); the camel-pubnub suite passes 
> (17 tests). No upgrade note: endpoints that failed to start now start.
> Affected: main (PubNub 13.4.4, verified); 4.14.x (PubNub 10.5.8) and 4.18.x 
> (PubNub 12.1.4) have the same builder code since 4.9 (not run against those 
> SDK versions).
> Duplicate check (2026-10-02): JIRA text "pubnub" (17 issues) and "secretKey" 
> with "pubnub" (none): nothing on this. GitHub pull requests "pubnub": 
> dependency bumps and #15685 (closed bump to 10.0.0) only.
> _Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to