Claus Ibsen created CAMEL-26124:
-----------------------------------
Summary: camel-jt400 - a program call without outputFieldsIdx
fails with a NullPointerException, and a List body fails with a
ClassCastException
Key: CAMEL-26124
URL: https://issues.apache.org/jira/browse/CAMEL-26124
Project: Camel
Issue Type: Bug
Components: camel-jt400
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of smb, jt400 and jcr (CAMEL-24961,
PR #28417).
h4. 1. A program call without outputFieldsIdx fails with a NullPointerException
{{Jt400PgmProducer.getParameterList}} (main 2a465aa4814c, line 115) calls
{{isFieldIdxForOuput(i)}} for every parameter, and
{{Jt400Endpoint.isFieldIdxForOuput}} (line 251) calls
{{Arrays.binarySearch(getOutputFieldsIdxArray(), idx)}}, which throws a
NullPointerException when {{outputFieldsIdx}} is not set. A program call with
only input parameters cannot work. Checked on 4.24.0-SNAPSHOT by building the
program parameter list (no IBM i).
Proposed: treat a missing {{outputFieldsIdx}} as no output fields.
h4. 2. A List body for a program call fails with a raw ClassCastException
The producer casts the body to {{Object[]}} ({{Jt400PgmProducer}}, main
2a465aa4814c, lines 107 and 182), so a {{List}} body (a natural choice in a
route) fails with a ClassCastException instead of being used or rejected with a
clear error. Checked on 4.24.0-SNAPSHOT by building the program parameter list
(no IBM i).
Proposed: use {{getMandatoryBody(Object[].class)}} (a List converts) so other
bodies fail with an InvalidPayloadException.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)