You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Robbie Gemmell (JIRA)" <ji...@apache.org> on 2015/06/09 19:03:00 UTC

[jira] [Updated] (QPIDJMS-48) inconsistent handling of property names in Message methods

     [ https://issues.apache.org/jira/browse/QPIDJMS-48?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robbie Gemmell updated QPIDJMS-48:
----------------------------------
    Description: 
The client validates the values passed to get/Set*Property methods, enforcing that they are valid Java identifier names. It does not however validate the values returned from/given to the getPropertyNames or propertyExists methods, meaning it could return (or indicate presence) of properties that dont meet the JMS requirements, but then fail to allow setting/accessing them.

The behaviour of getPropertyNames or propertyExists should be updated to match the validating behaviour of the get/Set*Property methods. An option will be added to enable disabling the validation.

Original Text:
The Qpid C++ broker - which supports both AMQP 0.10 and 1.0 - delivers quite often messages with a property containing "." in the property name. In particular, the property "qpid.subject" can be seen quite often, because it is attached automatically to the message by some AMQP 0.10 clients.

The current handling of message properties with "." in their name seems to be a bit strange in the Qpid JMS client. When the client receives a message with this property, its property name is returned by the method getPropertyNames() including the dot. However, when I try to call some method to actually get the property value - e.g. getStringProperty("qpid.subject"), I get an exception:

javax.jms.JMSException: Identifier contains invalid JMS identifier character '.': 'qpid.subject' 
	at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:77)
	at org.apache.qpid.jms.JmsConnection.onException(JmsConnection.java:481)
	at org.apache.qpid.jms.JmsMessageConsumer$MessageDeliverTask.run(JmsMessageConsumer.java:602)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IllegalArgumentException: Identifier contains invalid JMS identifier character '.': 'qpid.subject' 
	at org.apache.qpid.jms.message.JmsMessage.checkIdentifierLetterAndDigitRequirements(JmsMessage.java:568)
	at org.apache.qpid.jms.message.JmsMessage.checkIdentifierFormat(JmsMessage.java:531)
	at org.apache.qpid.jms.message.JmsMessage.checkPropertyNameIsValid(JmsMessage.java:527)
	at org.apache.qpid.jms.message.JmsMessage.getObjectProperty(JmsMessage.java:296)
	at org.apache.qpid.jms.message.JmsMessage.getStringProperty(JmsMessage.java:393)
	at cz.scholz.amqp10.jms.Listener.onMessage(Listener.java:72)
	at org.apache.qpid.jms.JmsMessageConsumer$MessageDeliverTask.run(JmsMessageConsumer.java:592)
	... 3 more

This causes problems when you client wants to iterate over all message properties and I think the behavior should be more consistent. If the property is returned by getPropertyNames(), then the get*Property() should work too. Or other way around - if get*Property cannot be used for such property, it should not be returned in getPropertyNames().

  was:
The Qpid C++ broker - which supports both AMQP 0.10 and 1.0 - delivers quite often messages with a property containing "." in the property name. In particular, the property "qpid.subject" can be seen quite often, because it is attached automatically to the message by some AMQP 0.10 clients.

The current handling of message properties with "." in their name seems to be a bit strange in the Qpid JMS client. When the client receives a message with this property, its property name is returned by the method getPropertyNames() including the dot. However, when I try to call some method to actually get the property value - e.g. getStringProperty("qpid.subject"), I get an exception:

javax.jms.JMSException: Identifier contains invalid JMS identifier character '.': 'qpid.subject' 
	at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:77)
	at org.apache.qpid.jms.JmsConnection.onException(JmsConnection.java:481)
	at org.apache.qpid.jms.JmsMessageConsumer$MessageDeliverTask.run(JmsMessageConsumer.java:602)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IllegalArgumentException: Identifier contains invalid JMS identifier character '.': 'qpid.subject' 
	at org.apache.qpid.jms.message.JmsMessage.checkIdentifierLetterAndDigitRequirements(JmsMessage.java:568)
	at org.apache.qpid.jms.message.JmsMessage.checkIdentifierFormat(JmsMessage.java:531)
	at org.apache.qpid.jms.message.JmsMessage.checkPropertyNameIsValid(JmsMessage.java:527)
	at org.apache.qpid.jms.message.JmsMessage.getObjectProperty(JmsMessage.java:296)
	at org.apache.qpid.jms.message.JmsMessage.getStringProperty(JmsMessage.java:393)
	at cz.scholz.amqp10.jms.Listener.onMessage(Listener.java:72)
	at org.apache.qpid.jms.JmsMessageConsumer$MessageDeliverTask.run(JmsMessageConsumer.java:592)
	... 3 more

This causes problems when you client wants to iterate over all message properties and I think the behavior should be more consistent. If the property is returned by getPropertyNames(), then the get*Property() should work too. Or other way around - if get*Property cannot be used for such property, it should not be returned in getPropertyNames().

       Assignee: Robbie Gemmell
        Summary: inconsistent handling of property names in Message methods  (was: Handling of properties with "." in their name)

> inconsistent handling of property names in Message methods
> ----------------------------------------------------------
>
>                 Key: QPIDJMS-48
>                 URL: https://issues.apache.org/jira/browse/QPIDJMS-48
>             Project: Qpid JMS
>          Issue Type: Bug
>          Components: qpid-jms-client
>    Affects Versions: 0.1.0, 0.2.0
>            Reporter: Jakub Scholz
>            Assignee: Robbie Gemmell
>             Fix For: 0.3.0
>
>
> The client validates the values passed to get/Set*Property methods, enforcing that they are valid Java identifier names. It does not however validate the values returned from/given to the getPropertyNames or propertyExists methods, meaning it could return (or indicate presence) of properties that dont meet the JMS requirements, but then fail to allow setting/accessing them.
> The behaviour of getPropertyNames or propertyExists should be updated to match the validating behaviour of the get/Set*Property methods. An option will be added to enable disabling the validation.
> Original Text:
> The Qpid C++ broker - which supports both AMQP 0.10 and 1.0 - delivers quite often messages with a property containing "." in the property name. In particular, the property "qpid.subject" can be seen quite often, because it is attached automatically to the message by some AMQP 0.10 clients.
> The current handling of message properties with "." in their name seems to be a bit strange in the Qpid JMS client. When the client receives a message with this property, its property name is returned by the method getPropertyNames() including the dot. However, when I try to call some method to actually get the property value - e.g. getStringProperty("qpid.subject"), I get an exception:
> javax.jms.JMSException: Identifier contains invalid JMS identifier character '.': 'qpid.subject' 
> 	at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:77)
> 	at org.apache.qpid.jms.JmsConnection.onException(JmsConnection.java:481)
> 	at org.apache.qpid.jms.JmsMessageConsumer$MessageDeliverTask.run(JmsMessageConsumer.java:602)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at java.lang.Thread.run(Thread.java:744)
> Caused by: java.lang.IllegalArgumentException: Identifier contains invalid JMS identifier character '.': 'qpid.subject' 
> 	at org.apache.qpid.jms.message.JmsMessage.checkIdentifierLetterAndDigitRequirements(JmsMessage.java:568)
> 	at org.apache.qpid.jms.message.JmsMessage.checkIdentifierFormat(JmsMessage.java:531)
> 	at org.apache.qpid.jms.message.JmsMessage.checkPropertyNameIsValid(JmsMessage.java:527)
> 	at org.apache.qpid.jms.message.JmsMessage.getObjectProperty(JmsMessage.java:296)
> 	at org.apache.qpid.jms.message.JmsMessage.getStringProperty(JmsMessage.java:393)
> 	at cz.scholz.amqp10.jms.Listener.onMessage(Listener.java:72)
> 	at org.apache.qpid.jms.JmsMessageConsumer$MessageDeliverTask.run(JmsMessageConsumer.java:592)
> 	... 3 more
> This causes problems when you client wants to iterate over all message properties and I think the behavior should be more consistent. If the property is returned by getPropertyNames(), then the get*Property() should work too. Or other way around - if get*Property cannot be used for such property, it should not be returned in getPropertyNames().



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org