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

   Fixes [CAMEL-26091](https://issues.apache.org/jira/browse/CAMEL-26091), 
found while adding the catalog body types of aws2-redshift-data (#28343).
   
   **The bug.** `RedshiftData2Endpoint.doStart` builds a `RedshiftDataClient` 
in one of three ways: from the access key and the secret key, from the default 
credentials provider, or from a profile. But `RedshiftData2Producer` called 
every operation with `getConfiguration().getAwsRedshiftDataClient()`. That 
client is null unless one is given with the awsRedshiftDataClient option or as 
an autowired bean. So with keys, as the page says works, every exchange failed 
with:
   
   ```
   NullPointerException: Cannot invoke 
"...RedshiftDataClient.listDatabases(...)" because "redshiftDataClient" is null
   ```
   
   This has been so since the component was added in 4.1.0; the tests always 
bound a client.
   
   **The fix.** The producer now uses 
`getEndpoint().getAwsRedshiftDataClient()`, as the other AWS producers do. When 
a client is given, the endpoint keeps that one, so nothing changes for those 
users.
   
   **Tests**
   - `RedshiftData2ProducerOwnClientTest` configures an endpoint with only an 
access key and a secret key. It sends listDatabases to a local stub of the 
Redshift Data API, a JDK `HttpServer` reached through `uriEndpointOverride`. It 
fails without the fix with the NullPointerException above, and passes with it.
   - The 31 tests of `RedshiftData2Producer*Test` pass.
   
   The other items of CAMEL-26091 are not changed here:
   - no operation fails with a NullPointerException;
   - a `CamelAwsRedshiftDataSqlParameterList` of Strings fails with a 
ClassCastException.
   
   _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