@Test(expected=NullPointerException.class) public void testWriteObjectWithNullThrowsNPE() throws Exception { JmsBytesMessage bytesMessage = factory.createBytesMessage(); bytesMessage.writeObject(null); }
@Override public void writeObject(Object value) throws JMSException { if (value == null) { throw new NullPointerException(); } initializeWriting(); if (value instanceof Boolean) { writeBoolean(((Boolean) value).booleanValue()); } else if (value instanceof Character) { writeChar(((Character) value).charValue()); } else if (value instanceof Byte) { writeByte(((Byte) value).byteValue()); } else if (value instanceof Short) { writeShort(((Short) value).shortValue()); } else if (value instanceof Integer) { writeInt(((Integer) value).intValue()); } else if (value instanceof Long) { writeLong(((Long) value).longValue()); } else if (value instanceof Float) { writeFloat(((Float) value).floatValue()); } else if (value instanceof Double) { writeDouble(((Double) value).doubleValue()); } else if (value instanceof String) { writeUTF(value.toString()); } else if (value instanceof byte[]) { writeBytes((byte[]) value); } else { throw new MessageFormatException("Cannot write non-primitive type:" + value.getClass()); } }
JmsBytesMessage extends JmsMessage implements BytesMessage { @Override public void writeObject(Object value) throws JMSException { if (value == null) { throw new NullPointerException(); } initializeWriting(); if (value instanceof Boolean) { writeBoolean(((Boolean) value).booleanValue()); } else if (value instanceof Character) { writeChar(((Character) value).charValue()); } else if (value instanceof Byte) { writeByte(((Byte) value).byteValue()); } else if (value instanceof Short) { writeShort(((Short) value).shortValue()); } else if (value instanceof Integer) { writeInt(((Integer) value).intValue()); } else if (value instanceof Long) { writeLong(((Long) value).longValue()); } else if (value instanceof Float) { writeFloat(((Float) value).floatValue()); } else if (value instanceof Double) { writeDouble(((Double) value).doubleValue()); } else if (value instanceof String) { writeUTF(value.toString()); } else if (value instanceof byte[]) { writeBytes((byte[]) value); } else { throw new MessageFormatException("Cannot write non-primitive type:" + value.getClass()); } } }
JmsBytesMessage extends JmsMessage implements BytesMessage { @Override public void writeObject(Object value) throws JMSException { if (value == null) { throw new NullPointerException(); } initializeWriting(); if (value instanceof Boolean) { writeBoolean(((Boolean) value).booleanValue()); } else if (value instanceof Character) { writeChar(((Character) value).charValue()); } else if (value instanceof Byte) { writeByte(((Byte) value).byteValue()); } else if (value instanceof Short) { writeShort(((Short) value).shortValue()); } else if (value instanceof Integer) { writeInt(((Integer) value).intValue()); } else if (value instanceof Long) { writeLong(((Long) value).longValue()); } else if (value instanceof Float) { writeFloat(((Float) value).floatValue()); } else if (value instanceof Double) { writeDouble(((Double) value).doubleValue()); } else if (value instanceof String) { writeUTF(value.toString()); } else if (value instanceof byte[]) { writeBytes((byte[]) value); } else { throw new MessageFormatException("Cannot write non-primitive type:" + value.getClass()); } } JmsBytesMessage(JmsBytesMessageFacade facade); }
JmsBytesMessage extends JmsMessage implements BytesMessage { @Override public void writeObject(Object value) throws JMSException { if (value == null) { throw new NullPointerException(); } initializeWriting(); if (value instanceof Boolean) { writeBoolean(((Boolean) value).booleanValue()); } else if (value instanceof Character) { writeChar(((Character) value).charValue()); } else if (value instanceof Byte) { writeByte(((Byte) value).byteValue()); } else if (value instanceof Short) { writeShort(((Short) value).shortValue()); } else if (value instanceof Integer) { writeInt(((Integer) value).intValue()); } else if (value instanceof Long) { writeLong(((Long) value).longValue()); } else if (value instanceof Float) { writeFloat(((Float) value).floatValue()); } else if (value instanceof Double) { writeDouble(((Double) value).doubleValue()); } else if (value instanceof String) { writeUTF(value.toString()); } else if (value instanceof byte[]) { writeBytes((byte[]) value); } else { throw new MessageFormatException("Cannot write non-primitive type:" + value.getClass()); } } JmsBytesMessage(JmsBytesMessageFacade facade); @Override JmsBytesMessage copy(); @Override boolean equals(Object other); @Override int hashCode(); @Override void clearBody(); @Override long getBodyLength(); @Override boolean readBoolean(); @Override byte readByte(); @Override int readUnsignedByte(); @Override short readShort(); @Override int readUnsignedShort(); @Override char readChar(); @Override int readInt(); @Override long readLong(); @Override float readFloat(); @Override double readDouble(); @Override String readUTF(); @Override int readBytes(byte[] value); @Override int readBytes(byte[] value, int length); @Override void writeBoolean(boolean value); @Override void writeByte(byte value); @Override void writeShort(short value); @Override void writeChar(char value); @Override void writeInt(int value); @Override void writeLong(long value); @Override void writeFloat(float value); @Override void writeDouble(double value); @Override void writeUTF(String value); @Override void writeBytes(byte[] value); @Override void writeBytes(byte[] value, int offset, int length); @Override void writeObject(Object value); @Override void reset(); @Override void onSend(long producerTtl); @Override String toString(); @Override boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class target); }
JmsBytesMessage extends JmsMessage implements BytesMessage { @Override public void writeObject(Object value) throws JMSException { if (value == null) { throw new NullPointerException(); } initializeWriting(); if (value instanceof Boolean) { writeBoolean(((Boolean) value).booleanValue()); } else if (value instanceof Character) { writeChar(((Character) value).charValue()); } else if (value instanceof Byte) { writeByte(((Byte) value).byteValue()); } else if (value instanceof Short) { writeShort(((Short) value).shortValue()); } else if (value instanceof Integer) { writeInt(((Integer) value).intValue()); } else if (value instanceof Long) { writeLong(((Long) value).longValue()); } else if (value instanceof Float) { writeFloat(((Float) value).floatValue()); } else if (value instanceof Double) { writeDouble(((Double) value).doubleValue()); } else if (value instanceof String) { writeUTF(value.toString()); } else if (value instanceof byte[]) { writeBytes((byte[]) value); } else { throw new MessageFormatException("Cannot write non-primitive type:" + value.getClass()); } } JmsBytesMessage(JmsBytesMessageFacade facade); @Override JmsBytesMessage copy(); @Override boolean equals(Object other); @Override int hashCode(); @Override void clearBody(); @Override long getBodyLength(); @Override boolean readBoolean(); @Override byte readByte(); @Override int readUnsignedByte(); @Override short readShort(); @Override int readUnsignedShort(); @Override char readChar(); @Override int readInt(); @Override long readLong(); @Override float readFloat(); @Override double readDouble(); @Override String readUTF(); @Override int readBytes(byte[] value); @Override int readBytes(byte[] value, int length); @Override void writeBoolean(boolean value); @Override void writeByte(byte value); @Override void writeShort(short value); @Override void writeChar(char value); @Override void writeInt(int value); @Override void writeLong(long value); @Override void writeFloat(float value); @Override void writeDouble(double value); @Override void writeUTF(String value); @Override void writeBytes(byte[] value); @Override void writeBytes(byte[] value, int offset, int length); @Override void writeObject(Object value); @Override void reset(); @Override void onSend(long producerTtl); @Override String toString(); @Override boolean isBodyAssignableTo(@SuppressWarnings("rawtypes") Class target);  }