You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "allthingssecurity (via GitHub)" <gi...@apache.org> on 2026/10/15 00:06:21 UTC
[PR] CAMEL-25656: camel-netty-http - available() of the request body stream cache returns the bytes left to read [camel]
allthingssecurity opened a new pull request, #27859:
URL: https://github.com/apache/camel/pull/27859
# Description
[CAMEL-25656](https://issues.apache.org/jira/browse/CAMEL-25656)
Follow-up of the review of #27757 ([CAMEL-25573](https://issues.apache.org/jira/browse/CAMEL-25573)), where it was suggested as optional. `NettyChannelBufferStreamCache` holds the whole request body in a `ByteBuf` but did not override `InputStream.available()`, so it always returned 0.
`available()` now returns `buffer.readableBytes()`: the bytes that can still be read without blocking (the same value as `length()`), 0 at the end, and the whole length again after `reset()`.
Camel's own copies of this stream are not affected: the two-argument `IOHelper.copy`, which this class's `writeTo` and the type converters use, goes through `transferTo` and does not call `available()`. Only the `IOHelper.copy` overloads that take a buffer size read `available()`, and their only caller in core (`CachedOutputStream`) passes its own cache, not this stream.
Tests:
- New test `availableIsTheNumberOfBytesLeft` in `NettyChannelBufferStreamCacheTest`: a body of 5 bytes in a buffer of capacity 16; `available()` before and after reads, at the end, and after `reset()`. Without the change it fails: `expected: <5> but was: <0>`.
- camel-netty-http with the change: 313 tests, 0 failures, 8 skipped.
No upgrade-guide note: a reader cannot rely on `available()` returning 0, the `InputStream` contract allows any number of bytes that can be read without blocking.
What was not run: only the camel-netty-http tests, with JDK 21. The `GZIPInputStream` case named in the review was not tested: in the sources of JDK 21.0.11, `GZIPInputStream` does not call `available()` (checked in the sources of JDK 17.0.19 and 21.0.11).
# Target
- [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch)
# Tracking
- [ ] 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).
(The ticket is drafted and not filed yet; CAMEL-25656 is a placeholder until it is.)
# Apache Camel coding standards and style
- [x] I checked that each commit in the pull request has a meaningful subject line and body.
- [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes.
(I built and tested camel-netty-http, including the formatter and import-sort plugins. I did not run the full root build.)
# 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 PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer.
_Claude Code on behalf of allthingssecurity_
🤖 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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25656: camel-netty-http - available() of the request body stream cache returns the bytes left to read [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27859:
URL: https://github.com/apache/camel/pull/27859#issuecomment-6184658427
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `components/camel-netty-http`
> :information_source: Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the `test-dependents` label to force testing all dependents.
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 35 of 703 tested, 27 compile-only — current: 35 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **35 affected modules** (current approach: 35).
**Skip-tests mode would test 35 modules** (1 direct + 34 downstream), **skip tests for 27** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (35)</summary>
- `camel-a2a` ← downstream of org.apache.camel:camel-platform-http-vertx
- `camel-clickup` ← downstream of org.apache.camel:camel-netty-http
- `camel-java-joor-dsl` ← downstream of org.apache.camel:camel-telegram
- `camel-jbang-mcp` ← downstream of org.apache.camel:camel-xml-io-dsl
- `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-catalog
- `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-yaml-dsl-validator
- `camel-jsonpath` ← downstream of org.apache.camel:camel-platform-http-vertx
- `camel-knative-http` ← downstream of org.apache.camel:camel-platform-http-vertx
- `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
- `camel-mcp-server` ← downstream of org.apache.camel:camel-platform-http-vertx
- `camel-micrometer-prometheus` ← downstream of org.apache.camel:camel-platform-http-main
- `camel-netty-http` ← components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyChannelBufferStreamCache.java, components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyChannelBufferStreamCacheTest.java
- `camel-oauth` ← downstream of org.apache.camel:camel-netty-http
- `camel-observability-services` ← downstream of org.apache.camel:camel-micrometer-prometheus
- `camel-openai` ← downstream of org.apache.camel:camel-platform-http-vertx
- `camel-openapi-validator` ← downstream of org.apache.camel:camel-rest-openapi
- `camel-platform-http-main` ← downstream of org.apache.camel:camel-platform-http-vertx
- `camel-platform-http-vertx` ← downstream of org.apache.camel:camel-rest-openapi
- `camel-rest-openapi` ← downstream of org.apache.camel:camel-netty-http
- `camel-semantic` ← downstream of org.apache.camel:camel-xml-io-dsl
- `camel-state-store` ← downstream of org.apache.camel:camel-test-main-junit5
- `camel-telegram` ← downstream of org.apache.camel:camel-netty-http
- `camel-test-main-junit5` ← downstream of org.apache.camel:camel-xml-io-dsl
- `camel-test-main-junit6` ← downstream of org.apache.camel:camel-xml-io-dsl
- `camel-typesafe-ai` ← downstream of org.apache.camel:camel-xml-io-dsl
- `camel-webhook` ← downstream of org.apache.camel:camel-netty-http
- `camel-whatsapp` ← downstream of org.apache.camel:camel-netty-http
- `camel-wolf-defender` ← downstream of org.apache.camel:camel-semantic
- `camel-xml-io-dsl` ← downstream of org.apache.camel:camel-telegram
- `camel-xml-jaxb-dsl` ← downstream of org.apache.camel:camel-telegram
- `camel-xml-jaxb-dsl-test-definition` ← downstream of org.apache.camel:camel-telegram
- `camel-xml-jaxb-dsl-test-spring` ← downstream of org.apache.camel:camel-telegram
- `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-yaml-dsl
- `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
</details>
<details><summary>Modules with tests skipped (27)</summary>
- `apache-camel`
- `camel-allcomponents`
- `camel-catalog`
- `camel-catalog-console`
- `camel-catalog-maven`
- `camel-catalog-suggest`
- `camel-componentdsl`
- `camel-endpointdsl`
- `camel-endpointdsl-support`
- `camel-itest`
- `camel-jbang-core`
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-kamelet-main`
- `camel-launcher`
- `camel-report-maven-plugin`
- `camel-route-parser`
- `camel-yaml-dsl`
- `camel-yaml-dsl-deserializers`
- `camel-yaml-dsl-maven-plugin`
- `coverage`
- `docs`
- `dummy-component`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/38658081406)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25656: camel-netty-http - available() of the request body stream cache returns the bytes left to read [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27859:
URL: https://github.com/apache/camel/pull/27859
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25656: camel-netty-http - available() of the request body stream cache returns the bytes left to read [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27859:
URL: https://github.com/apache/camel/pull/27859#issuecomment-6184481713
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org