davsclaus opened a new pull request, #28900: URL: https://github.com/apache/camel/pull/28900
Fixes [CAMEL-26124](https://issues.apache.org/jira/browse/CAMEL-26124). ### 1. A program call without `outputFieldsIdx` failed with a NullPointerException `Jt400Endpoint.isFieldIdxForOuput` called `Arrays.binarySearch(getOutputFieldsIdxArray(), idx)`. The array is null when `outputFieldsIdx` is not set, so a program call with only input parameters always failed. Change: a missing `outputFieldsIdx` now means no output fields, so all parameters are input. ### 2. A `List` body failed with a raw ClassCastException `Jt400PgmProducer` cast the body to `Object[]` (when building the parameter list and when building the result). A `List` body failed with a ClassCastException. Change: both places use `getMandatoryBody(Object[].class)`. A `List` is converted to an array. A body that cannot be converted fails with an `InvalidPayloadException` (wrapped in `Jt400PgmCallException`, as before for any error). ### Tests New `Jt400PgmProducerTest` builds the program parameter list without an IBM i system (`getParameterList` is now package-private for that): - no `outputFieldsIdx`: all parameters are input - `List` body with `outputFieldsIdx=1`: converted, parameter 1 is output - a plain `Object` body: `InvalidPayloadException` All 3 tests fail without the fix (2 errors: NPE and ClassCastException, 1 failure: ClassCastException instead of `InvalidPayloadException`). Module build with `-Psourcecheck`: 37 tests, 0 failures, 2 skipped (existing manual tests). ### Docs `jt400-component.adoc` (and its catalog copy) now says a `List` body is accepted and that without `outputFieldsIdx` all parameters are input-only. No upgrade guide entry: both cases failed before. ### Not changed - `getOutputFieldLength` still fails with a NullPointerException when `fieldsLength` is not set. The docs examples always set it and text parameters need a length, so this is left as is. - `isFieldIdxForOuput` uses a binary search, so `outputFieldsIdx` must be listed in ascending order (e.g. `2,1` does not find `1`). Not part of this issue; left as is. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 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]
