@Test public void testClearBodyOnReceivedObjectMessageMakesMessageWritable() throws Exception { String content = "myStringContent"; JmsObjectMessageFacade facade = new JmsTestObjectMessageFacade(); facade.setObject(content); JmsObjectMessage objectMessage = new JmsObjectMessage(facade); objectMessage.onDispatch(); assertTrue("Message should not be writable", objectMessage.isReadOnlyBody()); objectMessage.clearBody(); assertFalse("Message should be writable", objectMessage.isReadOnlyBody()); }
@Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); try { this.facade.setObject(newObject); } catch (Exception e) { MessageFormatException jmsEx = new MessageFormatException("Failed to serialize object:" + e.getMessage()); jmsEx.setLinkedException(e); jmsEx.initCause(e); throw jmsEx; } }
JmsObjectMessage extends JmsMessage implements ObjectMessage { @Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); try { this.facade.setObject(newObject); } catch (Exception e) { MessageFormatException jmsEx = new MessageFormatException("Failed to serialize object:" + e.getMessage()); jmsEx.setLinkedException(e); jmsEx.initCause(e); throw jmsEx; } } }
JmsObjectMessage extends JmsMessage implements ObjectMessage { @Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); try { this.facade.setObject(newObject); } catch (Exception e) { MessageFormatException jmsEx = new MessageFormatException("Failed to serialize object:" + e.getMessage()); jmsEx.setLinkedException(e); jmsEx.initCause(e); throw jmsEx; } } JmsObjectMessage(JmsObjectMessageFacade facade); }
JmsObjectMessage extends JmsMessage implements ObjectMessage { @Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); try { this.facade.setObject(newObject); } catch (Exception e) { MessageFormatException jmsEx = new MessageFormatException("Failed to serialize object:" + e.getMessage()); jmsEx.setLinkedException(e); jmsEx.initCause(e); throw jmsEx; } } JmsObjectMessage(JmsObjectMessageFacade facade); @Override JmsObjectMessage copy(); @Override void setObject(Serializable newObject); @Override Serializable getObject(); @Override boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class target); @Override String toString(); }
JmsObjectMessage extends JmsMessage implements ObjectMessage { @Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); try { this.facade.setObject(newObject); } catch (Exception e) { MessageFormatException jmsEx = new MessageFormatException("Failed to serialize object:" + e.getMessage()); jmsEx.setLinkedException(e); jmsEx.initCause(e); throw jmsEx; } } JmsObjectMessage(JmsObjectMessageFacade facade); @Override JmsObjectMessage copy(); @Override void setObject(Serializable newObject); @Override Serializable getObject(); @Override boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class target); @Override String toString();  }