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 | 7d31aa4806315267f4f0e3b149fc954e58029262 (patch) | |
| tree | 6f392e1d27eed3a05070708cbacf3dd4b0de04d0 /qpid/java/client | |
| parent | b8dcc83c32cfbd7c0c92e5341f3572d9dea85567 (diff) | |
| download | qpid-python-7d31aa4806315267f4f0e3b149fc954e58029262.tar.gz | |
QPID-1236: made setObjectProperty validate the passed in value
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@685536 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client')
| -rw-r--r-- | qpid/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/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 5a57e7b0db..8b4488f1f9 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 @@ -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); } |
