Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2167

TestObjectStreamMarshaller doesn't use offset and size arguments

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 5.2.0.Alpha3
    • 5.2.0.ALPHA1
    • None
    • None
    • Hide

      Workaround currently is to make a copy that contains only the bytes that should be passed in and then pass in the byte[] with no arguments. This causes unneeded copying though for production code, as this only manifests itself when running tests.

      Show
      Workaround currently is to make a copy that contains only the bytes that should be passed in and then pass in the byte[] with no arguments. This causes unneeded copying though for production code, as this only manifests itself when running tests.

    Description

      The TestObjectStreamMarshaller.objectFromByteBuffer(byte[], int, int) method does not actually pass the array with offsets. The code made a copy using the offset and size, but then passes the wrong byte array in. This is causing some issues with some tests I am writing for a CacheStore that I had to work around for now.

      I personally don't see why it creates a copy of the array when it could just pass in the offset and size directly and not incur the cost of copying the byte array again. I have a fix that just passes the offset and index directly to the ByteArrayInputStream instead of doing the copy. If you feel that the copy is still needed obviously then just change it to pass in newBytes as the change instead.

      I will attach a pull request soon.

      Attachments

        Activity

          People

            gzamarre Galder ZamarreƱo
            rpwburns William Burns (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: