oscerd opened a new pull request, #25400:
URL: https://github.com/apache/camel/pull/25400
Two defects in `GoogleSheetsStreamConsumer`, both covered by a new test.
**1. `splitResults` reported range index 1 for every value.** The counter
was allocated *inside* the
loop over the ranges:
```java
for (ValueRange valueRange : response.getValueRanges()) {
AtomicInteger rangeIndex = new AtomicInteger(1);
...
rangeIndex.incrementAndGet(); // dead: a fresh counter next iteration
}
```
So a consumer configured with `range=A1:B2,C1:D2&splitResults=true` sent
every exchange with
`CamelGoogleSheetsRangeIndex=1`, and there was no way to tell which range a
value came from. The
counter now spans the whole response, which is what the non-split branch
already did.
**2. A range without values threw.** `valueRange.getValues()` was
dereferenced directly in both
branches, but the Sheets API omits the `values` field for a range that holds
nothing, so polling a
spreadsheet with an empty range failed with a `NullPointerException` on
every cycle.
Two smaller things while in there: the exchange building moved into
`createExchanges(List<ValueRange>)`
so it can be tested without a Google client (the API client needs a real
transport), and the branch
that reads a whole spreadsheet — used when no `range` is configured — now
calls `forceConsumerAsReady()`
as well, so the consumer health check reports ready on that path too.
_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]