Uploaded image for project: 'JBoss A-MQ'
  1. JBoss A-MQ
  2. ENTMQ-1989

activemq-client return unexpected length code on first read from stream containing empty byte array

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • JBoss A-MQ 6.3
    • None

      Consider this code

      	private void testEmptyBufferInput() throws JMSException {
      		byte[] readList = new byte[BYTE_LIST.length - 1];
      		byte[] emptyList = {};
      		LOG.info("Streaming BYTE_LIST message testing EMPTY buffer input");
      		stream.writeBytes(emptyList);
      		stream.reset();
      		LOG.info("Reading BYTE_LIST message testing EMPTY buffer input");
      		final int IS_EMPTY = 0;
      		assertThat(stream.readBytes(readList)).isEqualTo(IS_EMPTY);
      	}
      

      The code above works with qpid-jms, but fails with activemq-client on the assertThat with error message java.lang.AssertionError: Not true that <-1> is equal to <0>. Judging by documentation http://docs.oracle.com/javaee/6/api/javax/jms/BytesMessage.html#readBytes(byte[]), I think that qpid-jms behavior is correct and what activemq-client does is a bug.

            Unassigned Unassigned
            jdanek@redhat.com Jiri Daněk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: