diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2011-03-03 06:22:14 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2011-03-03 06:22:14 +0000 |
commit | c1979c9f419cc57649196e5dc30b0d36cec5c6c5 (patch) | |
tree | 6a3fbf764824934815699e47e3da800915093554 | |
parent | ce920ef0dbc6fe2322a14a6849878d8ebe475077 (diff) | |
download | qpid-python-c1979c9f419cc57649196e5dc30b0d36cec5c6c5.tar.gz |
QPID-2930
The getPropertyNames method will filter out any property names whose values are not allowed as per the JMS spec.
I could have used the ALLOWED map to check if a value is a valid type.
But unfortunately that map contains byte[] as a valid type, which is not correct as per the JMS spec.
I did not want to modify that map or the behaviour of the setObjectProperty or getObjectProperty methods as there might be applications out there that is depending on it.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1076532 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java index 92e61984d2..fb7b191656 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java @@ -22,10 +22,12 @@ package org.apache.qpid.client.message; import java.lang.ref.SoftReference; +import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -670,7 +672,19 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate public Enumeration getPropertyNames() throws JMSException { - return java.util.Collections.enumeration(getApplicationHeaders().keySet()); + List<String> props = new ArrayList<String>(); + Map<String, Object> propertyMap = getApplicationHeaders(); + for (String prop: getApplicationHeaders().keySet()) + { + Object value = propertyMap.get(prop); + if (value instanceof Boolean || value instanceof Number + || value instanceof String) + { + props.add(prop); + } + } + + return java.util.Collections.enumeration(props); } public void setBooleanProperty(String propertyName, boolean b) throws JMSException |