tmielke opened a new pull request, #26334:
URL: https://github.com/apache/camel/pull/26334
# Description
When the Brotli4j API jar is on the classpath (e.g. pulled transitively via
`quarkus-vertx-http`) without the platform-native JNI library, HttpClient
5's
`Brotli4jRuntime.available()` only checks class presence, not JNI
loadability.
This causes it to advertise "br" in Accept-Encoding and then fail with
`UnsatisfiedLinkError` at decompression time.
Fix: at class-load time, reflectively call `Brotli4jLoader.isAvailable()`
which
verifies the native library actually loads. When it reports unavailable,
re-register all HttpClient content decoders except Brotli via
`setContentDecoderRegistry()`, preserving `gzip`, `deflate`, `zstd` and
any other
codec whose native library is present.
## Test plan
- `brotli4jAvailabilityShouldMatchLoaderState` — verifies the reflective
`isBrotli4jAvailable()` check agrees with calling
`Brotli4jLoader.isAvailable()`
directly (passes on both native-available and native-unavailable
machines)
- `brotli4jLoaderClassShouldBeOnClasspath` — confirms the API jar is on
the test
classpath so the test above is validating native-lib detection, not a
missing class
- `acceptEncodingShouldReflectBrotli4jAvailability` — starts a local HTTP
server,
sends a request, and asserts that the `Accept-Encoding` header includes
`br` only
when the native library is actually loadable
Co-Authored-By: Claude Opus 4.6 <[email protected]>
# Target
- [x] I checked that the commit is targeting the correct branch (Camel 4
uses the `main` branch)
# Tracking
- [x] If this is a large change, bug fix, or code improvement, I checked
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for
the change (usually before you start working on it).
# Apache Camel coding standards and style
- [x] I checked that each commit in the pull request has a meaningful
subject line and body.
- [x] I have run `mvn clean install -DskipTests` locally from root folder
and I have committed all auto-generated changes.
# AI-assisted contributions
- [x] If this PR includes AI-generated code, commits have proper
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR
description identifies the AI tool used.
--
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]