Author: gtully Date: Mon Aug 9 09:12:45 2010 New Revision: 983564 URL: http://svn.apache.org/viewvc?rev=983564&view=rev Log: resolve: https://issues.apache.org/activemq/browse/AMQ-2840 - add test and apply patch with thanks Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java?rev=983564&r1=983563&r2=983564&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java Mon Aug 9 09:12:45 2010 @@ -273,7 +273,7 @@ public class ActiveMQMessage extends Mes public boolean propertyExists(String name) throws JMSException { try { - return this.getProperties().containsKey(name); + return (this.getProperties().containsKey(name) || getObjectProperty(name)!= null); } catch (IOException e) { throw JMSExceptionSupport.create(e); } @@ -281,7 +281,9 @@ public class ActiveMQMessage extends Mes public Enumeration getPropertyNames() throws JMSException { try { - return new Vector(this.getProperties().keySet()).elements(); + Vector result = new Vector(this.getProperties().keySet()); + result.addAll(new Vector(JMS_PROPERTY_SETERS.keySet())); + return result.elements(); } catch (IOException e) { throw JMSExceptionSupport.create(e); } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java?rev=983564&r1=983563&r2=983564&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java Mon Aug 9 09:12:45 2010 @@ -281,6 +281,9 @@ public class ActiveMQMessageTest extends ActiveMQMessage msg = new ActiveMQMessage(); msg.setStringProperty("test", "test"); assertTrue(msg.propertyExists("test")); + + msg.setIntProperty("JMSXDeliveryCount", 1); + assertTrue(msg.propertyExists("JMSXDeliveryCount")); } public void testGetBooleanProperty() throws JMSException { @@ -349,11 +352,19 @@ public class ActiveMQMessageTest extends public void testGetPropertyNames() throws JMSException { ActiveMQMessage msg = new ActiveMQMessage(); - String name = "floatProperty"; - msg.setFloatProperty(name, 1.3f); + String name1 = "floatProperty"; + msg.setFloatProperty(name1, 1.3f); + String name2 = "JMSXDeliveryCount"; + msg.setIntProperty("name2", 1); + boolean found1 = false; + boolean found2 = false; for (Enumeration iter = msg.getPropertyNames(); iter.hasMoreElements();) { - assertTrue(iter.nextElement().equals(name)); + Object element = iter.nextElement(); + found1 |= element.equals(name1); + found2 |= element.equals(name2); } + assertTrue("prop name1 found", found1); + assertTrue("prop name2 found", found2); } public void testSetObjectProperty() throws JMSException {