Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix buffer recycler in lzf

  • Loading branch information...
commit 768c6d2922e4189fdc05811aa21d166174a6819f 1 parent 9c6dfc1
@kimchy kimchy authored
View
12 ...les/elasticsearch/src/main/java/org/elasticsearch/common/compress/lzf/BufferRecycler.java
@@ -34,7 +34,7 @@
private final static int MIN_OUTPUT_BUFFER = 8000;
/**
- * This <code>ThreadLocal</code> contains a {@link java.lang.ref.SoftRerefence}
+ * This <code>ThreadLocal</code> contains a {@link java.lang.ref.SoftReference}
* to a {@link BufferRecycler} used to provide a low-cost
* buffer recycling for buffers we need for encoding, decoding.
*/
@@ -101,7 +101,7 @@ public void releaseEncodeBuffer(byte[] buffer) {
}
public void releaseOutputBuffer(byte[] buffer) {
- if (_outputBuffer == null || buffer.length > _outputBuffer.length) {
+ if (_outputBuffer == null || (buffer != null && buffer.length > _outputBuffer.length)) {
_outputBuffer = buffer;
}
}
@@ -117,7 +117,7 @@ public void releaseOutputBuffer(byte[] buffer) {
}
public void releaseEncodingHash(int[] buffer) {
- if (_encodingHash == null || buffer.length > _encodingHash.length) {
+ if (_encodingHash == null || (buffer != null && buffer.length > _encodingHash.length)) {
_encodingHash = buffer;
}
}
@@ -139,7 +139,7 @@ public void releaseEncodingHash(int[] buffer) {
}
public void releaseInputBuffer(byte[] buffer) {
- if (_inputBuffer == null || buffer.length > _inputBuffer.length) {
+ if (_inputBuffer == null || (buffer != null && buffer.length > _inputBuffer.length)) {
_inputBuffer = buffer;
}
}
@@ -155,9 +155,9 @@ public void releaseInputBuffer(byte[] buffer) {
}
public void releaseDecodeBuffer(byte[] buffer) {
- if (_decodingBuffer == null || buffer.length > _decodingBuffer.length) {
+ if (_decodingBuffer == null || (buffer != null && buffer.length > _decodingBuffer.length)) {
_decodingBuffer = buffer;
}
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.