On 3/15/24 11:50, Ciaran wrote:
Hi,
I'm attempting to build a resilient client using the protonj2 client and as
part of my testing I was checking that it would handle messages with null
bodies (specifically my client is only willing to work with strings or byte
arrays so it rejects any other AMQP message body type). However, when I put
a null body on the message (i.e. body length of 0), when I de-reference the
delivery's message's body property (e.g. delivery.message().body) I receive
an error from the proton engine:
Can you capture a frame trace, I need enough information to try and
create an exact reproducer which can be aided with traces of the
incoming frames to reverse engineer a test. I wouldn't expect and
exception here and its likely something that was missed in the current
test suite.
Code snippets of the sender and receiver bits can help as well.
Caused by: org.apache.qpid.protonj2.client.exceptions.ClientException:
Index 1 out of bounds for length 1
at
org.apache.qpid.protonj2.client.impl.ClientExceptionSupport.createNonFatalOrPassthrough(
ClientExceptionSupport.java:103)
at org.apache.qpid.protonj2.client.impl.ClientMessageSupport.decodeMessage(
ClientMessageSupport.java:170)
at org.apache.qpid.protonj2.client.impl.ClientMessageSupport.decodeMessage(
ClientMessageSupport.java:152)
at org.apache.qpid.protonj2.client.impl.ClientDelivery.message(
ClientDelivery.java:79)
at
com.thisisnumero.smartagent.gateway.inbound.sources.background.amqp.AMQPMessageConsumerImpl.internalConsumeMessages(
AMQPMessageConsumerImpl.java:53)
... 4 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds
for length 1
at
org.apache.qpid.protonj2.buffer.impl.ProtonCompositeBufferImpl.findChunkWithIndex(
ProtonCompositeBufferImpl.java:1530)
at org.apache.qpid.protonj2.buffer.impl.ProtonCompositeBufferImpl.copyInto(
ProtonCompositeBufferImpl.java:387)
at
org.apache.qpid.protonj2.codec.decoders.messaging.DataTypeDecoder.readValue(
DataTypeDecoder.java:85)
at
org.apache.qpid.protonj2.codec.decoders.messaging.DataTypeDecoder.readValue(
DataTypeDecoder.java:40)
at org.apache.qpid.protonj2.codec.decoders.ProtonDecoder.readObject(
ProtonDecoder.java:192)
at org.apache.qpid.protonj2.client.impl.ClientMessageSupport.decodeMessage(
ClientMessageSupport.java:168)
... 7 more
My expectation from the comments on the 'body()' method is that I should
expect it to return null in this scenario? Should I be trapping this
exception and rejecting the messages to avoid poisoning my queue? (I was
planning on rejecting them anyway, but it seems weird to have to catch the
exception first.)
For reference, I'm putting messages onto the queue with the following
protonj2 calls:
sender.send(Message.create((byte[])null));
sender.send(Message.create((*String*)null));
Thank you (and sorry for the bombardment of things)
--
Tim Bish
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org