Details
-
Bug
-
Resolution: Done
-
Minor
-
JBoss A-MQ 6.1
-
None
Description
Sending a JMS message with JMSType set to "null" over AMQP throws the following java.lang.NullPointerException on the broker side:
org.apache.activemq.transport.amqp.AmqpProtocolException: Could not process AMQP commands at org.apache.activemq.transport.amqp.AmqpProtocolConverter.onFrame(AmqpProtocolConverter.java:317) at org.apache.activemq.transport.amqp.AmqpProtocolConverter.onAMQPData(AmqpProtocolConverter.java:224) at org.apache.activemq.transport.amqp.AmqpTransportFilter.onCommand(AmqpTransportFilter.java:96) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214) at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196) at java.lang.Thread.run(Thread.java:695) Caused by: java.lang.NullPointerException at org.apache.qpid.proton.jms.InboundTransformer.populateMessage(InboundTransformer.java:141) at org.apache.qpid.proton.jms.AMQPNativeInboundTransformer.transform(AMQPNativeInboundTransformer.java:37) at org.apache.activemq.transport.amqp.AmqpProtocolConverter$ProducerContext.onMessage(AmqpProtocolConverter.java:556) at org.apache.activemq.transport.amqp.AmqpProtocolConverter$BaseProducerContext.onDelivery(AmqpProtocolConverter.java:531) at org.apache.activemq.transport.amqp.AmqpProtocolConverter.onFrame(AmqpProtocolConverter.java:288) ... 6 more
If seem the org.apache.qpid.proton.jms.InboundTransformer#populateMessage assumes the value for JMSType property is not null
... final MessageAnnotations ma = amqp.getMessageAnnotations(); if( ma!=null ) { for (Map.Entry<?,?> entry : ma.getValue().entrySet()) { String key = entry.getKey().toString(); if( "x-opt-jms-type".equals(key.toString()) ) { line 141: jms.setJMSType(entry.getValue().toString()); } ...
From JMS spec v1.1 section 3.12
"The JMS message interfaces provide write/set methods for setting object
values in a message body and message properties. All of these methods must
be implemented to copy their input objects into the message. The value of an
input object is allowed to be null and will return null when accessed."
As JMS spec allows nulls to be set and returned then I think the JMS-AMQP binding should be able to deal with them as well.