diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java index 199fd9eda3..71a39f80ca 100644 --- a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java +++ b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java @@ -912,6 +912,12 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag } } + @Override + public void setObjectProperty(String name, Object value) throws JMSException { + initializeWriting(); + super.setObjectProperty(name, value); + } + @Override public String toString() { return super.toString() + " ActiveMQBytesMessage{ " + "bytesOut = " + bytesOut + ", dataOut = " + dataOut + ", dataIn = " + dataIn + " }"; diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java index 6b01d0533b..0219815688 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/command/ActiveMQBytesMessageTest.java @@ -269,30 +269,6 @@ public class ActiveMQBytesMessageTest extends TestCase { } } - public void testClearProperties() throws Exception { - ActiveMQBytesMessage bytesMessage = new ActiveMQBytesMessage(); - bytesMessage.setIntProperty("one", 1); - // simulate send - bytesMessage.onSend(); - - assertEquals(1, bytesMessage.getIntProperty("one")); - assertTrue(bytesMessage.isReadOnlyProperties()); - - try { - bytesMessage.setIntProperty("two", 2); - fail("should have thrown b/c readonly"); - } catch (MessageNotWriteableException expected) { - } - - // allow writing new properties - bytesMessage.clearProperties(); - assertFalse(bytesMessage.propertyExists("one")); - assertFalse(bytesMessage.isReadOnlyProperties()); - - bytesMessage.setIntProperty("two", 2); - assertEquals(2, bytesMessage.getIntProperty("two")); - } - public void testReset() throws JMSException { ActiveMQBytesMessage message = new ActiveMQBytesMessage(); try {