lucene4: finish org.elasticsearch.common.compress cleanup

This commit is contained in:
Igor Motov 2012-10-30 23:19:38 -04:00 committed by Shay Banon
parent 93906903b6
commit f57efcf6c8
3 changed files with 4 additions and 3 deletions

View File

@ -73,7 +73,8 @@ public class CompressedDirectory extends Directory implements ForceSyncDirectory
@Override @Override
public long fileLength(String name) throws IOException { public long fileLength(String name) throws IOException {
if (actualLength && decompressExtensions.contains(getExtension(name))) { if (actualLength && decompressExtensions.contains(getExtension(name))) {
IndexInput in = openInput(name); // LUCENE 4 UPGRADE: Is this the right IOContext?
IndexInput in = openInput(name, IOContext.READONCE);
try { try {
return in.length(); return in.length();
} catch (Exception e) { } catch (Exception e) {

View File

@ -65,7 +65,7 @@ public class LZFCompressedIndexInput extends CompressedIndexInput<LZFCompressorC
} }
@Override @Override
public Object clone() { public IndexInput clone() {
LZFCompressedIndexInput cloned = (LZFCompressedIndexInput) super.clone(); LZFCompressedIndexInput cloned = (LZFCompressedIndexInput) super.clone();
cloned.inputBuffer = new byte[LZFChunk.MAX_CHUNK_LEN]; cloned.inputBuffer = new byte[LZFChunk.MAX_CHUNK_LEN];
return cloned; return cloned;

View File

@ -59,7 +59,7 @@ public abstract class SnappyCompressedIndexInput extends CompressedIndexInput<Sn
} }
@Override @Override
public Object clone() { public IndexInput clone() {
SnappyCompressedIndexInput cloned = (SnappyCompressedIndexInput) super.clone(); SnappyCompressedIndexInput cloned = (SnappyCompressedIndexInput) super.clone();
cloned.inputBuffer = new byte[inputBuffer.length]; cloned.inputBuffer = new byte[inputBuffer.length];
return cloned; return cloned;