Skip to content

Commit d350c03

Browse files
pjfanningganesh-ctds
authored andcommitted
[fix][test] Replace LZ4FastDecompressor with LZ4SafeDecompressor in test (apache#25032)
(cherry picked from commit 0156ff1)
1 parent 1a9b8c6 commit d350c03

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pulsar-common/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@
223223
</dependency>
224224

225225
<dependency>
226-
<groupId>org.lz4</groupId>
226+
<groupId>at.yawk.lz4</groupId>
227227
<artifactId>lz4-java</artifactId>
228-
<version>1.8.1</version>
228+
<version>1.9.0</version>
229229
<scope>test</scope>
230230
</dependency>
231231

pulsar-common/src/test/java/org/apache/pulsar/common/compression/CompressionCodecLZ4JNI.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import lombok.extern.slf4j.Slf4j;
2525
import net.jpountz.lz4.LZ4Compressor;
2626
import net.jpountz.lz4.LZ4Factory;
27-
import net.jpountz.lz4.LZ4FastDecompressor;
27+
import net.jpountz.lz4.LZ4SafeDecompressor;
2828
import org.apache.pulsar.common.allocator.PulsarByteBufAllocator;
2929

3030
/**
@@ -44,7 +44,7 @@ public class CompressionCodecLZ4JNI implements CompressionCodec {
4444

4545
private static final LZ4Factory lz4Factory = LZ4Factory.fastestInstance();
4646
private static final LZ4Compressor compressor = lz4Factory.fastCompressor();
47-
private static final LZ4FastDecompressor decompressor = lz4Factory.fastDecompressor();
47+
private static final LZ4SafeDecompressor decompressor = lz4Factory.safeDecompressor();
4848

4949
@Override
5050
public ByteBuf encode(ByteBuf source) {
@@ -67,10 +67,10 @@ public ByteBuf decode(ByteBuf encoded, int uncompressedLength) throws IOExceptio
6767
ByteBuffer uncompressedNio = uncompressed.nioBuffer(0, uncompressedLength);
6868

6969
ByteBuffer encodedNio = encoded.nioBuffer(encoded.readerIndex(), encoded.readableBytes());
70-
decompressor.decompress(encodedNio, encodedNio.position(), uncompressedNio, uncompressedNio.position(),
71-
uncompressedNio.remaining());
70+
decompressor.decompress(encodedNio, encodedNio.position(), encodedNio.remaining(),
71+
uncompressedNio, uncompressedNio.position(), uncompressedNio.remaining());
7272

7373
uncompressed.writerIndex(uncompressedLength);
7474
return uncompressed;
7575
}
76-
}
76+
}

0 commit comments

Comments
 (0)