Issue Details (XML | Word | Printable)

Key: GLASSFISH-12564
Type: Bug Bug
Status: Reopened Reopened
Priority: Major Major
Assignee: Nigel Deakin
Reporter: exabrial
Votes: 1
Watchers: 3

If you were logged in you would be able to see more operations.

Cannot set null string property on Object Message

Created: 07/Jul/10 10:12 AM   Updated: 15/Feb/13 12:23 PM
Component/s: jms
Affects Version/s: v3.0.1
Fix Version/s: 4.0.1

Time Tracking:
Not Specified


Operating System: All
Platform: All

Issue Links:

Issuezilla Id: 12,564
Tags: 3_1-exclude
Participants: exabrial, Nigel Deakin, Satish Kumar and vladchuk

 Description  « Hide

glassfish v3.0.1
sun jdk 1.6.0_20
windows xp 32bit

The JMS Message interface javadoc states that null is valid value for a string
property on a message.

If you invoke this code in a stateless ejb, you receive the stack trace below

Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(destination);
ObjectMessage message = session.createObjectMessage();
message.setObject(new Object());
message.setStringProperty("aStringProperty", null);

Caused by: java.lang.NullPointerException

Satish Kumar added a comment - 06/Oct/10 07:28 AM

Setting target milestone and reassigning this to Nigel ..

Nigel Deakin added a comment - 11/Oct/10 03:41 AM

Updating target milestone to M5 to confirm that this is already fixed.

Nigel Deakin added a comment - 12/Oct/10 04:35 AM

Oops, ignore previous comment added to the wrong issue in error. Setting target
milestone back to M7.

Nigel Deakin added a comment - 12/Oct/10 04:47 AM

In GlassFish 3.1 the error is

SEVERE: Error processing message
javax.jms.MessageFormatException: [C4040]: Invalid ObjectProperty type for
property aStringProperty

Nigel Deakin added a comment - 12/Oct/10 04:52 AM

(previous stack trace was for LOCAL brokers),

And in GlassFish 3.1 the stack trace is

Caused by: java.lang.NullPointerException

which matches what the submitted reported.

Nigel Deakin added a comment - 12/Oct/10 05:45 AM

I've read the JMS 1.1 specification and the JavaDoc for javax.jms.Message, and
have not seen anything which suggests setting a String property can be set to
null. (Feel free to argue).

The behaviour when using a LOCAL broker is correct, which is to throw a

The behaviour when using a EMBEDDED broker is incorrect. A NullPointerException
should not be thrown; a MessageFormatException should be thrown instead. I will
make this change.

Nigel Deakin added a comment - 12/Oct/10 05:55 AM

The exception that is thrown when an embedded broker is used has been changed to:

javax.jms.MessageFormatException: MQJMSRA_DM4001:
setStringProperty():name=aStringProperty:value=null:Bad property value: null

Nigel Deakin added a comment - 18/Oct/10 07:49 AM

Section 3.12 of the JMS spec "Provider Implementations of JMS Message
Interfaces" states:

"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."

Reopening this issue and setting target milestone to M7.

Nigel Deakin added a comment - 26/Oct/10 10:26 AM

This does seem a valid complaint, though as it's a spec misinterpretation rather
than a bug, and MQ has almost certainly had this behaviour for many years,
fixing it can't be considered a priority for 3.1.

I'm leaving this as a P3 priority, but deferring it until 3.2 (MQ 4.6).

vladchuk added a comment - 11/Dec/11 12:55 AM

Why is this not being addressed in 3.1.2? It seems that 3.2 has been abandoned (superseded by 4.0) and 4.0 is far away.
Please consider fixing it in 3.1.2.

exabrial added a comment - 09/Jan/12 07:01 PM

any chance this could be fixed in 3.1.2? I can't imagine this is a difficult fix.

Nigel Deakin added a comment - 03/May/12 10:39 AM

I've logged MQ-165 and made this issue dependent on it.

Nigel Deakin added a comment - 15/Feb/13 12:23 PM

In accordance with the project triage guidelines this is not needed for 4.0 and so has been deferred until 4.0.1. Setting "fix version" accordingly.