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

   # Description
   
   [CAMEL-25657](https://issues.apache.org/jira/browse/CAMEL-25657)
   
   Follow-up of the review of #27760 
([CAMEL-25576](https://issues.apache.org/jira/browse/CAMEL-25576)). 
`BoxEventLogsManager.getEnterpriseEvents` reads the event log chunk by chunk 
and stops on an empty chunk, on the same position again, or when there is no 
next position. The last check could not fire: in box-java-sdk 4.16.4 the 
`EventLog` constructor reads `next_stream_position` with `isString() ? 
asString() : toString()`, so a JSON null becomes the text `"null"`, never a 
Java null. A chunk with events and a null next position therefore made the 
manager send one more request with `stream_position=null`.
   
   The loop now also stops when the next position is the text `"null"`. The 
`null` check stays.
   
   Tests:
   - New test `stopsWhenTheServiceReturnsNoNextPosition` in 
`BoxEventLogsManagerPagingTest` (the Box connection answers from memory through 
a request interceptor): one chunk of two events whose `next_stream_position` is 
a JSON null. The two events are returned and only one request is sent. Without 
the change it fails: `a request was sent at the position "null" ==> expected: 
<false> but was: <true>`.
   - The interceptor of the test now answers a request at the position `"null"` 
with an empty chunk instead of failing in `Integer.parseInt`, so that the test 
fails on the assertion and not on the fake.
   - camel-box (camel-box-api has no tests, camel-box-component runs its unit 
tests): 7 tests, 0 failures.
   
   No upgrade-guide note: the only difference is one request less, in a case 
where the service gives no next position.
   
   What was not run: the integration tests of camel-box (they need a Box 
account), and nothing against the Box service. That the SDK turns a JSON null 
into `"null"` was read from the class file of box-java-sdk 4.16.4; whether the 
service sends a null next position at all was not checked.
   
   # 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-25657 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-box-api and camel-box-component, 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to