gnodet opened a new pull request, #31280:
URL: https://github.com/apache/camel/pull/31280
# CAMEL-27992: camel-aws-secrets-manager — CloudTrail refresh fails with
overrideEndpoint and no URI; doc names wrong environment variables
## Problem
Two bugs in `CloudTrailReloadTriggerTask.doStart()`:
### Bug 1: NullPointerException when `overrideEndpoint=true` and no URI set
When the vault is configured with `overrideEndpoint=true` but no
`uriEndpointOverride`, starting the
CloudTrail reload trigger task threw a `NullPointerException`:
```
java.lang.NullPointerException: null
at java.net.URI.create(URI.java:...)
at
...CloudTrailReloadTriggerTask.doStart(CloudTrailReloadTriggerTask.java:256)
```
Both the CloudTrail client builder branch (line 256) and the SQS client
builder branch (line 278)
called `URI.create(uriEndpointOverride)` unconditionally.
### Bug 2: Five env var constants used wrong prefix
Five private constants had string values using `CAMEL_AWS_VAULT_*` instead
of the correct
`CAMEL_VAULT_AWS_*` prefix documented in the component:
| Constant field | Old value (wrong) | New value (correct) |
|---|---|---|
| `CAMEL_AWS_VAULT_PROFILE_NAME_ENV` | `CAMEL_AWS_VAULT_PROFILE_NAME` |
`CAMEL_VAULT_AWS_PROFILE_NAME` |
| `CAMEL_AWS_VAULT_SQS_QUEUE_URL_ENV` | `CAMEL_AWS_VAULT_SQS_QUEUE_URL` |
`CAMEL_VAULT_AWS_SQS_QUEUE_URL` |
| `CAMEL_AWS_VAULT_USE_SQS_NOTIFICATION_ENV` |
`CAMEL_AWS_VAULT_USE_SQS_NOTIFICATION` | `CAMEL_VAULT_AWS_USE_SQS_NOTIFICATION`
|
| `CAMEL_AWS_VAULT_IS_OVERRIDE_ENDPOINT` |
`CAMEL_AWS_VAULT_IS_OVERRIDE_ENDPOINT` | `CAMEL_VAULT_AWS_IS_OVERRIDE_ENDPOINT`
|
| `CAMEL_AWS_VAULT_URI_ENDPOINT_OVERRIDE` |
`CAMEL_AWS_VAULT_URI_ENDPOINT_OVERRIDE` |
`CAMEL_VAULT_AWS_URI_ENDPOINT_OVERRIDE` |
As a result, users setting these env vars with the correct documented prefix
had them silently ignored.
## Fix
- Added `ObjectHelper.isNotEmpty(uriEndpointOverride)` guard to both
`URI.create()` calls so a
missing URI is treated the same as `overrideEndpoint=false`.
- Corrected the five string literal values to use `CAMEL_VAULT_AWS_*`.
## Tests
Added `CloudTrailReloadTriggerTaskInitTest` covering:
1. CloudTrail-mode: `overrideEndpoint=true` + null URI → no NPE
2. SQS-mode: `overrideEndpoint=true` + null URI → no NPE
3. All five corrected env-var constant values use the `CAMEL_VAULT_AWS_`
prefix (verified via reflection on the private static fields)
All 41 tests in the module pass.
---
_AI-generated on behalf of gnodet_
--
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]