Bugs item #633800, was opened at 2002-11-05 05:16
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=633800&group_id=22866

Category: JBossMQ
Group: v3.0 Rabbit Hole
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Daniel Sieroka (sieroka)
Assigned to: Nathan W. Phelps (nphelps)
Summary: Cannot call setProperty() after clear()

Initial Comment:
The JMS spec says that you can set properties on 
incoming JMS messages:

lObjectMessage.clearBody();
lObjectMessage.setStringProperty( "PROPERTY", 
lProperty );

With JBoss 3.0.3 I get the following error:

javax.jms.MessageNotWriteableException: Properties 
are read-only
at org.jboss.mq.SpyMessage.setStringProperty
(SpyMessage.java:423)
at 
com.platespin.oss.apps.masterwatch.ejb.MhwDetailedSt
atsMessageBean.onMessage
(MhwDetailedStatsMessageBean.java:173)
at java.lang.reflect.Method.invoke(Native Method)
at 
org.jboss.ejb.MessageDrivenContainer$ContainerIntercep
tor.invoke(MessageDrivenContainer.java:391)
at 
org.jboss.resource.connectionmanager.CachedConnectio
nInterceptor.invoke
(CachedConnectionInterceptor.java:186)
at 
org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.i
nvoke(MessageDrivenInstanceInterceptor.java:88)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext
(AbstractTxInterceptor.java:107)
at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransacti
ons(TxInterceptorCMT.java:178)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
(TxInterceptorCMT.java:60)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke
(RunAsSecurityInterceptor.java:100)
at org.jboss.ejb.plugins.LogInterceptor.invoke
(LogInterceptor.java:203)
at org.jboss.ejb.MessageDrivenContainer.invoke
(MessageDrivenContainer.java:302)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke
(JMSContainerInvoker.java:962)
at 
org.jboss.ejb.plugins.jms.JMSContainerInvoker$Message
ListenerImpl.onMessage(JMSContainerInvoker.java:1038)
at org.jboss.jms.asf.StdServerSession.onMessage
(StdServerSession.java:238)
at 
org.jboss.mq.SpyMessageConsumer.sessionConsumer
ProcessMessage(SpyMessageConsumer.java:603)
at org.jboss.mq.SpyMessageConsumer.addMessage
(SpyMessageConsumer.java:417)
at org.jboss.mq.SpySession.run(SpySession.java:259)
at org.jboss.jms.asf.StdServerSession.run
(StdServerSession.java:177)
at 
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Work
er.run(PooledExecutor.java:642)
at java.lang.Thread.run(Thread.java:479)


----------------------------------------------------------------------

Comment By: Nathan W. Phelps (nphelps)
Date: 2002-11-27 07:44

Message:
Logged In: YES 
user_id=130188

You are incorrect.  The JMS Specification section 3.10 says:

"When a message is received, its header field values can be 
changed; however, its property entries and its body are read-
only, as specified in this chapter.

The rationale for the read-only restriction is that it gives JMS 
providers more freedom in how they implement the 
management of received messages. For instance, they may 
return a message object that references property entries and 
body values that reside in an internal message buffer rather 
than being forced to make a copy.

A consumer can modify a received message after calling 
either the clearBody or clearProperties method to make the 
body or properties writable. If the consumer modifies a 
received message, and the message is subsequently 
redelivered, the redelivered message must be the original, 
unmodified message (except for headers and properties 
modified by the JMS provider as a result of the redelivery, 
such as the JMSRedelivered header and the 
JMSXDeliveryCount property)."

In other words, the properties in question are read only until 
you call clearProperties.  Your call to clearBody only clears 
the body and sets it to read/write.  JBossMQ is therefore, in 
compliance with the specification in this case.  You need to 
change your code to call clearProperties instead of 
clearBody and then you will be able to successfully set 
properties.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=633800&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to