[
https://issues.apache.org/jira/browse/CAMEL-27154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27154:
--------------------------------
Description:
The YAML DSL validator follows the body through the steps of a route
(CAMEL-24844), and reports a field read on a body that is not parsed yet, such
as ${body.qty} or a Groovy body.lines on text: the read fails at runtime. What
a running integration saw at an endpoint fills in what the catalog does not
know (CAMEL-25750).
The validator treats bytes as text. So a read of a name that text has is let
through on bytes too: lines, trim, blank and others. A byte[] has none of them.
In the local-model benchmark (connect-service-jms-request-reply step 3, r32 to
r35), the stock service gets the order as a byte[] from JMS: the route before
sends the file it read, and JMS sends a file as a BytesMessage. The model wrote
a Groovy expression that reads body.lines, and the route failed with "No such
property: lines for class: [B". The running app had seen the byte[] at
jms:queue:stock, but lines is a property of text, so the validator said
nothing. This was the failure in 8 of 21 runs of that step.
There is a second reason. A jms, sjms or amqp consumer written as uri: jms with
the parameters destinationType and destinationName was known to the validator
as jms:stock. The YAML DSL builds it as jms:queue:stock, and the running app
names it so. So what the running app saw at such a consumer was never found.
Proposal:
* The validator names the endpoint as the YAML DSL builds it:
destinationType:destinationName (jms:queue:stock).
* The validator knows when the body is bytes: what the running app saw
(byte[]), or a consumer that the catalog says gives only bytes.
* On bytes, the names of text (lines, text, trim, blank, chars, bytes) are
field reads. The message says that the body is still bytes: "..., but the body
here is still bytes (a byte[]), not parsed data - in the running app, from:
jms:queue:stock gave a byte[]: unmarshal it first ...". Names that any object
or array has, such as length or size, are not reported.
was:
The YAML DSL validator follows the body through the steps of a route
(CAMEL-24844), and reports a field read on a body that is not parsed yet, such
as ${body.qty} or a Groovy body.lines on text: the read fails at runtime. What
a running integration saw at an endpoint fills in what the catalog does not
know (CAMEL-25750).
The validator treats bytes as text. So a read of a name that text has is let
through on bytes too: lines, trim, blank and others. A byte[] has none of them.
In the local-model benchmark (connect-service-jms-request-reply step 3, r32 to
r35), the stock service gets the order as a byte[] from JMS: the route before
sends the file it read, and JMS sends a file as a BytesMessage. The model wrote
a Groovy expression that reads body.lines, and the route failed with "No such
property: lines for class: [B". The running app had seen the byte[] at
jms:queue:stock, but lines is a property of text, so the validator said
nothing. This was the failure in 8 of 21 runs of that step.
Proposal: the validator knows when the body is bytes: what the running app saw
(byte[]), or a consumer the catalog says gives only bytes. On bytes, only
length and class can be read without parsing, and the message says that the
body is still bytes: "..., but the body here is still bytes (a byte[]), not
parsed data - in the running app, from: jms:queue:stock gave a byte[]:
unmarshal it first ...".
> camel-yaml-dsl-validator - a field read on a body of bytes is reported, as on
> a body of text
> --------------------------------------------------------------------------------------------
>
> Key: CAMEL-27154
> URL: https://issues.apache.org/jira/browse/CAMEL-27154
> Project: Camel
> Issue Type: Improvement
> Components: camel-yaml-dsl
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> The YAML DSL validator follows the body through the steps of a route
> (CAMEL-24844), and reports a field read on a body that is not parsed yet,
> such as ${body.qty} or a Groovy body.lines on text: the read fails at
> runtime. What a running integration saw at an endpoint fills in what the
> catalog does not know (CAMEL-25750).
> The validator treats bytes as text. So a read of a name that text has is let
> through on bytes too: lines, trim, blank and others. A byte[] has none of
> them.
> In the local-model benchmark (connect-service-jms-request-reply step 3, r32
> to r35), the stock service gets the order as a byte[] from JMS: the route
> before sends the file it read, and JMS sends a file as a BytesMessage. The
> model wrote a Groovy expression that reads body.lines, and the route failed
> with "No such property: lines for class: [B". The running app had seen the
> byte[] at jms:queue:stock, but lines is a property of text, so the validator
> said nothing. This was the failure in 8 of 21 runs of that step.
> There is a second reason. A jms, sjms or amqp consumer written as uri: jms
> with the parameters destinationType and destinationName was known to the
> validator as jms:stock. The YAML DSL builds it as jms:queue:stock, and the
> running app names it so. So what the running app saw at such a consumer was
> never found.
> Proposal:
> * The validator names the endpoint as the YAML DSL builds it:
> destinationType:destinationName (jms:queue:stock).
> * The validator knows when the body is bytes: what the running app saw
> (byte[]), or a consumer that the catalog says gives only bytes.
> * On bytes, the names of text (lines, text, trim, blank, chars, bytes) are
> field reads. The message says that the body is still bytes: "..., but the
> body here is still bytes (a byte[]), not parsed data - in the running app,
> from: jms:queue:stock gave a byte[]: unmarshal it first ...". Names that any
> object or array has, such as length or size, are not reported.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)