[
https://issues.apache.org/jira/browse/CAMEL-16907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17407624#comment-17407624
]
Jesse Gorzinski commented on CAMEL-16907:
-----------------------------------------
Current behavior results in ClassCastExceptions whenever int or String values
are specified
{code:java}
Caused by: java.lang.ClassCastException: java.lang.Integer incompatible with [B
at com.ibm.as400.access.AS400ByteArray.toBytes(AS400ByteArray.java:125)
~[jt400-10.6.jar:JTOpen 10.6]
at com.ibm.as400.access.AS400ByteArray.toBytes(AS400ByteArray.java:100)
~[jt400-10.6.jar:JTOpen 10.6]
at
org.apache.camel.component.jt400.Jt400PgmProducer.getParameterList(Jt400PgmProducer.java:131)
~[camel-jt400-3.12.0-SNAPSHOT.jar:3.12.0-SNAPSHOT]
Caused by: java.lang.ClassCastException: java.lang.String incompatible with [B
at com.ibm.as400.access.AS400ByteArray.toBytes(AS400ByteArray.java:125)
~[jt400-10.6.jar:JTOpen 10.6]
at com.ibm.as400.access.AS400ByteArray.toBytes(AS400ByteArray.java:100)
~[jt400-10.6.jar:JTOpen 10.6]
at
org.apache.camel.component.jt400.Jt400PgmProducer.getParameterList(Jt400PgmProducer.java:131)
~[camel-jt400-3.12.0-SNAPSHOT.jar:3.12.0-SNAPSHOT]
{code}
> Program Call usability concerns
> -------------------------------
>
> Key: CAMEL-16907
> URL: https://issues.apache.org/jira/browse/CAMEL-16907
> Project: Camel
> Issue Type: Improvement
> Components: camel-jt400
> Affects Versions: 3.11.0
> Reporter: Jesse Gorzinski
> Priority: Minor
> Fix For: 3.12.0
>
>
> The program call abilities are not very usable.
> When running in binary mode, all parameters must be converted to byte arrays,
> like so:
> {code:java}
> final int usrSpcSize = 16;//16776704;
> final String pgmCallUri =
> String.format("jt400://*CURRENT:*CURRENt@localhost/qsys.lib/QUSRTVUS.PGM?fieldsLength=20,4,4,%d&outputFieldsIdx=3&format=binary",
> usrSpcSize);
> context.addRoutes(new RouteBuilder() {
> @Override
> public void configure() {
> from("timer://foo?period=5000")
> .process( exchange -> {
> String usrSpc = "MYSPACE JESSEG ";
> Object[] parms = new Object[] {
> usrSpc.getBytes("Cp037"), // Qualified user space
> name
> intToBytes(1), // starting position
> intToBytes(usrSpcSize), // length of data
> new byte[usrSpcSize] // output
> };
> exchange.getIn().setBody(parms);
> })
> .to(pgmCallUri)
> .setBody(simple("${body[3]}"))
> .to("stream:out");
> }
> });
> {code}
> Note, any character output must be explicitly converted from an EBCDIC byte
> array to a String (but the ccsid is unknown, so the "Cp037" in the above
> example is just a guess)
> In non-binary mode, all input parameters must be text, and I can't figure out
> how to actually send common data types, most notably integers.
> I will work on and likely send a PR shortly
--
This message was sent by Atlassian Jira
(v8.3.4#803005)