Claus Ibsen created CAMEL-27922:
-----------------------------------
Summary: camel-mllp: component buffer and bind options lost,
charsetName overwritten, wrong MSA scan of a route-set acknowledgement
Key: CAMEL-27922
URL: https://issues.apache.org/jira/browse/CAMEL-27922
Project: Camel
Issue Type: Bug
Components: camel-mllp
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-mllp for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31180).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. Component lenientBind, minBufferSize and maxBufferSize are lost
{{MllpConfiguration.copy}} does not copy lenientBind, minBufferSize and
maxBufferSize, and both MllpComponent.createEndpoint and the MllpEndpoint
constructor go through copy(), so these are lost when set on the component
(also through the configuration option).
Proposed change: add them to copy().
h4. 2. The component charsetName is overwritten
{{MllpComponent.createEndpoint}} always calls
endpoint.setCharsetName(getDefaultCharset()), which replaces a charsetName set
on the component.
Proposed change: only set it when the copied configuration has none.
h4. 3. Route-set acknowledgement: MSA looked up in the received message
{{MllpTcpServerConsumer.sendAcknowledgement}}: when the route sets
CamelMllpAcknowledgement or CamelMllpAcknowledgementString, the code scans the
received message for the MSA segment instead of the acknowledgement (and
switches on acknowledgementMessageBytes[1] instead of
acknowledgmentTypeBytes[1]), so CamelMllpAcknowledgementType is not set from
it; originalHl7MessageBytes[3] throws ArrayIndexOutOfBoundsException for a
payload shorter than 4 bytes and the connection is reset.
Proposed change: scan the acknowledgement bytes.
h4. 4. MllpException ignores logPhiMaxBytes
{{MllpException}} creates new Hl7Util(5120, logPhi), so exception messages
ignore the logPhiMaxBytes of the component.
Proposed change: pass the component value.
h4. 5. Smaller issues
{{MllpSocketBuffer.write(byte[], offset, count)}} scans for frame indexes from
offset to count instead of offset + count.
Hl7Util.generateInvalidPayloadExceptionMessage reports
hl7Bytes[validationLength - 2] as the wrong terminator (should be - 1). The
sendAcknowledgement error message prints the type of the bytes property twice.
keepAlive and tcpNoDelay are labelled producer and reuseAddress consumer, but
both sides use them; exchangePattern is labelled consumer but the producer
reads it; autoAck, hl7Headers and stringPayload are labelled common but only
the consumer uses them. hostname is required, but mllp:8888 works. The
MllpEndpoint Javadoc names a system property org.apache.camel.mllp.logPHI that
no code reads.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)