Revert "AMQ-7291 - allow setting properties after clearProperties for BytesMessage, closes #420"

This reverts commit 503416a001.
This commit is contained in:
jbonofre 2020-03-10 16:16:01 +01:00
parent bbb73ec3fc
commit 6355f507c3
2 changed files with 6 additions and 24 deletions

View File

@ -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 + " }";

View File

@ -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 {