Skip to content

Commit

Permalink
fix compression-strategy-test (#12575)
Browse files Browse the repository at this point in the history
fixes an issue caused by a test modification in #12408 that was closing buffers allocated by the compression strategy instead of allowing the closer to do it
  • Loading branch information
clintropolis authored May 31, 2022
1 parent 02ae3e7 commit 0640c9c
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,15 @@ public void testConcurrency() throws Exception
.allocateOutBuffer(originalData.length, closer);
ByteBuffer compressionIn = compressionStrategy.getCompressor()
.allocateInBuffer(originalData.length, closer);
try {
compressionIn.put(originalData);
compressionIn.position(0);
ByteBuffer compressed = compressionStrategy.getCompressor().compress(compressionIn, compressionOut);
ByteBuffer output = compressionStrategy.getCompressor().allocateOutBuffer(originalData.length, closer);
compressionStrategy.getDecompressor().decompress(compressed, compressed.remaining(), output);
byte[] checkArray = new byte[DATA_SIZER];
output.get(checkArray);
Assert.assertArrayEquals("Uncompressed data does not match", originalData, checkArray);
return true;
}
finally {
ByteBufferUtils.free(compressionIn);
ByteBufferUtils.free(compressionOut);
}
compressionIn.put(originalData);
compressionIn.position(0);
ByteBuffer compressed = compressionStrategy.getCompressor().compress(compressionIn, compressionOut);
ByteBuffer output = compressionStrategy.getCompressor().allocateOutBuffer(originalData.length, closer);
compressionStrategy.getDecompressor().decompress(compressed, compressed.remaining(), output);
byte[] checkArray = new byte[DATA_SIZER];
output.get(checkArray);
Assert.assertArrayEquals("Uncompressed data does not match", originalData, checkArray);
return true;
}
)
);
Expand Down

0 comments on commit 0640c9c

Please sign in to comment.