rishabhdaim opened a new pull request, #6:
URL: 
https://github.com/apache/sling-org-apache-sling-graphql-schema-aggregator/pull/6

   ## Summary
   
   `PartialReader.ParsedSection.getContent()` positioned a section's reader 
with a single `r.skip(startCharIndex)` call and ignored the return value. 
`Reader.skip()` is explicitly allowed by its JDK contract to skip fewer 
characters than requested in one call (e.g. readers wrapping buffered/decorated 
streams), so section content could start from the wrong offset, leaking raw 
section headers (`QUERY:`/`TYPES:` separators) into the aggregated SDL and 
breaking GraphQL parsing.
   
   ## Changes
   
   - `PartialReader.ParsedSection`: added a `skipFully()` helper that keeps 
skipping (falling back to `read()` when `skip()` makes no progress) until the 
requested offset is reached or EOF is hit, instead of relying on a single 
`skip()` call.
   - `PartialReaderTest`: added 
`sectionContentSkipsRobustlyWhenReaderSkipReturnsZero`, which exercises 
`ParsedSection` directly with a custom `Reader` (`ZeroSkipReader`, a 
`FilterReader` whose `skip()` always returns `0`) to reproduce the bug 
independently of `PartialReader`'s own line-ending normalization (which always 
hands `ParsedSection` a plain `StringReader` and would otherwise mask the 
issue).
   
   ## Test Plan
   
   - [x] New test `sectionContentSkipsRobustlyWhenReaderSkipReturnsZero` fails 
against the old code (`01234` instead of `56789`) and passes after the fix
   - [x] Full test suite passes (`mvn test`)
   
   ## Links
   
   - JIRA: https://issues.apache.org/jira/browse/SLING-13268
   
   Co-Authored-By: Claude Sonnet 5 <[email protected]>


-- 
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