diff options
| author | Andrew Donald Kennedy <grkvlt@apache.org> | 2010-07-26 08:52:31 +0000 |
|---|---|---|
| committer | Andrew Donald Kennedy <grkvlt@apache.org> | 2010-07-26 08:52:31 +0000 |
| commit | 0e5c0af8c298b1efda48999d40c150783270f51d (patch) | |
| tree | bde009a611bbac9d55d7bcd80d146f7ca13ebe28 /qpid/java | |
| parent | 45bd90654fcf2117938f4b6c17e2ad9b311d2f63 (diff) | |
| download | qpid-python-0e5c0af8c298b1efda48999d40c150783270f51d.tar.gz | |
QPID-2744: Make 0-10 code path throw a MessageFormatException on null setObjectProperty
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@979201 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
2 files changed, 7 insertions, 14 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 6e5974b85c..b256c5ec31 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 @@ -731,7 +731,11 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate { checkPropertyName(propertyName); checkWritableProperties(); - if (object != null && !ALLOWED.contains(object.getClass())) + if (object == null) + { + throw new MessageFormatException("Object is null"); + } + else if (!ALLOWED.contains(object.getClass())) { throw new MessageFormatException (String.format diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java index 15d1ff63cf..58bf7e85cf 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java @@ -99,19 +99,8 @@ public class JMSPropertiesTest extends QpidBrokerTestCase } catch (MessageFormatException mfe) { - // Check the cause - Throwable cause = mfe.getCause(); - assertNotNull(cause); - assertEquals("Incorrect cause ", AMQPInvalidClassException.class, cause.getClass()); - assertEquals("Null values are not allowed to be set", - "Only Primitives objects allowed Object is:null", cause.getMessage()); - - // Also check the linked exception - cause = mfe.getLinkedException(); - assertNotNull(cause); - assertEquals("Incorrect cause ", AMQPInvalidClassException.class, cause.getClass()); - assertEquals("Null values are not allowed to be set", - "Only Primitives objects allowed Object is:null", cause.getMessage()); + // Check the error message + assertTrue("Incorrect error message: " + mfe.getMessage(), mfe.getMessage().contains("Object is null")); } // send it |
