oscerd opened a new pull request, #25338:
URL: https://github.com/apache/camel/pull/25338
Three defects in `camel-google-storage`, all covered by new tests.
**1. Uploads stored the content type in two other blob fields.**
`processFile` read the
`Content-Encoding` and `Cache-Control` entries from the metadata map but
then passed the *content
type* variable to the builder:
```java
String ce = objectMetadata.remove("Content-Encoding");
if (ce != null) { builder.setContentEncoding(ct); } // ct == Content-Type
...
String cc = objectMetadata.remove("Cache-Control");
if (cc != null) { builder.setCacheControl(ct); } // ct == Content-Type
```
So an upload sending those headers ended up with the content type in both
fields — or `null`, when
no `Content-Type` header was sent at all.
**2. `getObject` NPE'd on a missing object.** `storage.get(BlobId)` returns
`null` when the object
is not there, and the result was dereferenced straight away. It now fails
with a message naming the
object and the bucket.
**3. The consumer NPE'd on every poll when the configured `objectName` was
missing.** Same null
blob, this time handed to `createExchange`. The poll now logs and yields no
exchange. That path also
never called `forceConsumerAsReady()`, so the consumer health check stayed
not-ready when
`objectName` was configured; it is now marked ready as soon as the storage
client answers, like on
the list path.
Two cleanups in the touched file: the `else` branch in `createDownloadLink`
was unreachable (the
header lookup already supplies the `300000L` default), and the `java.util.*`
wildcard import is
replaced with explicit ones.
**Not changed:** the audit that produced this issue also flagged that the
`objectName` endpoint
option wins over the `CamelGoogleCloudStorageObjectName` header. That is
deliberate — CAMEL-20998
made it so, because a consumer in the same route sets that header and would
otherwise hijack the
producer destination. Only a comment recording the reason was added, and the
item was withdrawn in a
comment on the JIRA issue.
_Claude Code on behalf of oscerd_
🤖 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]