diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2008-08-13 13:22:31 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2008-08-13 13:22:31 +0000 |
| commit | dbbf065ef5daf67db285b87ae6f7e0f980900875 (patch) | |
| tree | b3af8eee171346643cd6a1ade4add4c412aea8f8 /java/client | |
| parent | 33b3188f2e55d34e44869a15fab90e60fd1fda69 (diff) | |
| download | qpid-python-dbbf065ef5daf67db285b87ae6f7e0f980900875.tar.gz | |
QPID-1236: made setObjectProperty validate the passed in value
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@685536 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java b/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java index 5a57e7b0db..8b4488f1f9 100644 --- a/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java +++ b/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java @@ -736,10 +736,32 @@ public class AMQMessageDelegate_0_10 implements AMQMessageDelegate setApplicationHeader(propertyName, value); } + private static final Set<Class> ALLOWED = new HashSet(); + static + { + ALLOWED.add(Boolean.class); + ALLOWED.add(Byte.class); + ALLOWED.add(Short.class); + ALLOWED.add(Integer.class); + ALLOWED.add(Long.class); + ALLOWED.add(Float.class); + ALLOWED.add(Double.class); + ALLOWED.add(Character.class); + ALLOWED.add(String.class); + ALLOWED.add(byte[].class); + } + public void setObjectProperty(String propertyName, Object object) throws JMSException { checkPropertyName(propertyName); checkWritableProperties(); + if (object != null && !ALLOWED.contains(object.getClass())) + { + throw new MessageFormatException + (String.format + ("Cannot set a %s, allowed property types are: %s", + object.getClass(), ALLOWED)); + } setApplicationHeader(propertyName, object); } |
