mirror of https://github.com/apache/lucene.git
LUCENE-3405: rename IOUtils.close methods
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1162394 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ce5a9a107f
commit
3ed03b8488
|
@ -89,7 +89,11 @@ public class PKIndexSplitter {
|
|||
createIndex(config2, dir2, reader, docsInFirstIndex, true);
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, reader);
|
||||
if (success) {
|
||||
IOUtils.close(reader);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +104,11 @@ public class PKIndexSplitter {
|
|||
w.addIndexes(new DocumentFilteredIndexReader(reader, preserveFilter, negateFilter));
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, w);
|
||||
if (success) {
|
||||
IOUtils.close(w);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ public class NRTCachingDirectory extends Directory {
|
|||
in = cache.openInput(fileName, context);
|
||||
in.copyBytes(out, in.length());
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, in, out);
|
||||
IOUtils.close(in, out);
|
||||
}
|
||||
synchronized(this) {
|
||||
cache.deleteFile(fileName);
|
||||
|
|
|
@ -87,7 +87,7 @@ final class DocFieldProcessor extends DocConsumer {
|
|||
consumers.finish(state.numDocs);
|
||||
};
|
||||
// close perDocConsumer during flush to ensure all files are flushed due to PerCodec CFS
|
||||
IOUtils.closeSafely(false, perDocConsumers.values());
|
||||
IOUtils.close(perDocConsumers.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -108,7 +108,7 @@ final class DocFieldProcessor extends DocConsumer {
|
|||
}
|
||||
}
|
||||
try {
|
||||
IOUtils.closeSafely(true, perDocConsumers.values());
|
||||
IOUtils.closeWhileHandlingException(perDocConsumers.values());
|
||||
// TODO add abort to PerDocConsumer!
|
||||
} catch (IOException e) {
|
||||
// ignore on abort!
|
||||
|
|
|
@ -174,9 +174,9 @@ public final class FieldsReader implements Cloneable, Closeable {
|
|||
public final void close() throws IOException {
|
||||
if (!closed) {
|
||||
if (isOriginal) {
|
||||
IOUtils.closeSafely(false, fieldsStream, indexStream, fieldsStreamTL, cloneableFieldsStream, cloneableIndexStream);
|
||||
IOUtils.close(fieldsStream, indexStream, fieldsStreamTL, cloneableFieldsStream, cloneableIndexStream);
|
||||
} else {
|
||||
IOUtils.closeSafely(false, fieldsStream, indexStream, fieldsStreamTL);
|
||||
IOUtils.close(fieldsStream, indexStream, fieldsStreamTL);
|
||||
}
|
||||
closed = true;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ final class FieldsWriter {
|
|||
void close() throws IOException {
|
||||
if (directory != null) {
|
||||
try {
|
||||
IOUtils.closeSafely(false, fieldsStream, indexStream);
|
||||
IOUtils.close(fieldsStream, indexStream);
|
||||
} finally {
|
||||
fieldsStream = indexStream = null;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,11 @@ final class FreqProxTermsWriter extends TermsHashConsumer {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, consumer);
|
||||
if (success) {
|
||||
IOUtils.close(consumer);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(consumer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2270,7 +2270,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
} catch(IOException ex) {
|
||||
prior = ex;
|
||||
} finally {
|
||||
IOUtils.closeSafely(prior, cfsDir);
|
||||
IOUtils.closeWhileHandlingException(prior, cfsDir);
|
||||
}
|
||||
// Perform the merge
|
||||
|
||||
|
@ -2606,7 +2606,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
}
|
||||
}
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, cfsdir);
|
||||
IOUtils.close(cfsdir);
|
||||
}
|
||||
|
||||
info.dir = directory;
|
||||
|
|
|
@ -152,7 +152,7 @@ public class MultiPerDocValues extends PerDocValues {
|
|||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
IOUtils.closeSafely(false, this.subs);
|
||||
IOUtils.close(this.subs);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -88,7 +88,11 @@ final class NormsWriter extends InvertedDocEndConsumer {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, normsOut);
|
||||
if (success) {
|
||||
IOUtils.close(normsOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(normsOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ final class PerFieldCodecWrapper extends Codec {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, consumers);
|
||||
IOUtils.closeWhileHandlingException(consumers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ final class PerFieldCodecWrapper extends Codec {
|
|||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
IOUtils.closeSafely(false, consumers);
|
||||
IOUtils.close(consumers);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ final class PerFieldCodecWrapper extends Codec {
|
|||
// If we hit exception (eg, IOE because writer was
|
||||
// committing, or, for any other reason) we must
|
||||
// go back and close all FieldsProducers we opened:
|
||||
IOUtils.closeSafely(true, producers.values());
|
||||
IOUtils.closeWhileHandlingException(producers.values());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ final class PerFieldCodecWrapper extends Codec {
|
|||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
IOUtils.closeSafely(false, codecs.values());
|
||||
IOUtils.close(codecs.values());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ final class PerFieldCodecWrapper extends Codec {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, producers.values());
|
||||
IOUtils.closeWhileHandlingException(producers.values());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ final class PerFieldCodecWrapper extends Codec {
|
|||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
IOUtils.closeSafely(false, codecs.values());
|
||||
IOUtils.close(codecs.values());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ final class PerFieldCodecWrapper extends Codec {
|
|||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
IOUtils.closeSafely(false, consumers);
|
||||
IOUtils.close(consumers);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -122,7 +122,7 @@ final class SegmentCoreReaders {
|
|||
|
||||
synchronized void decRef() throws IOException {
|
||||
if (ref.decrementAndGet() == 0) {
|
||||
IOUtils.closeSafely(false, fields, perDocProducer, termVectorsReaderOrig,
|
||||
IOUtils.close(fields, perDocProducer, termVectorsReaderOrig,
|
||||
fieldsReaderOrig, cfsReader, storeCFSReader);
|
||||
// Now, notify any ReaderFinished listeners:
|
||||
if (owner != null) {
|
||||
|
|
|
@ -331,7 +331,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentInfo> {
|
|||
if (!success) {
|
||||
// We hit an exception above; try to close the file
|
||||
// but suppress any exception:
|
||||
IOUtils.closeSafely(true, segnOutput);
|
||||
IOUtils.closeWhileHandlingException(segnOutput);
|
||||
try {
|
||||
// Try not to leave a truncated segments_N file in
|
||||
// the index:
|
||||
|
|
|
@ -573,7 +573,11 @@ final class SegmentMerger {
|
|||
slices.toArray(ReaderUtil.Slice.EMPTY_ARRAY)));
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, consumer);
|
||||
if (success) {
|
||||
IOUtils.close(consumer);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(consumer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,7 +606,11 @@ final class SegmentMerger {
|
|||
docsConsumer.merge(mergeState, multiPerDocValues);
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, docsConsumer);
|
||||
if (success) {
|
||||
IOUtils.close(docsConsumer);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(docsConsumer);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* don't close the perDocProducers here since they are private segment producers
|
||||
|
@ -654,7 +662,11 @@ final class SegmentMerger {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, output);
|
||||
if (success) {
|
||||
IOUtils.close(output);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(output);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ class TermVectorsReader implements Cloneable, Closeable {
|
|||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
IOUtils.closeSafely(false, tvx, tvd, tvf);
|
||||
IOUtils.close(tvx, tvd, tvf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,7 +57,7 @@ final class TermVectorsTermsWriter extends TermsHashConsumer {
|
|||
fill(state.numDocs);
|
||||
assert state.segmentName != null;
|
||||
String idxName = IndexFileNames.segmentFileName(state.segmentName, "", IndexFileNames.VECTORS_INDEX_EXTENSION);
|
||||
IOUtils.closeSafely(false, tvx, tvf, tvd);
|
||||
IOUtils.close(tvx, tvf, tvd);
|
||||
tvx = tvd = tvf = null;
|
||||
if (4+((long) state.numDocs)*16 != state.directory.fileLength(idxName)) {
|
||||
throw new RuntimeException("after flush: tvx size mismatch: " + state.numDocs + " docs vs " + state.directory.fileLength(idxName) + " length in bytes of " + idxName + " file exists?=" + state.directory.fileExists(idxName));
|
||||
|
@ -107,7 +107,7 @@ final class TermVectorsTermsWriter extends TermsHashConsumer {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, tvx, tvd, tvf);
|
||||
IOUtils.closeWhileHandlingException(tvx, tvd, tvf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ final class TermVectorsTermsWriter extends TermsHashConsumer {
|
|||
public void abort() {
|
||||
hasVectors = false;
|
||||
try {
|
||||
IOUtils.closeSafely(true, tvx, tvd, tvf);
|
||||
IOUtils.closeWhileHandlingException(tvx, tvd, tvf);
|
||||
} catch (IOException e) {
|
||||
// cannot happen since we suppress exceptions
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
@ -45,7 +45,7 @@ final class TermVectorsWriter {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, tvx, tvd, tvf);
|
||||
IOUtils.closeWhileHandlingException(tvx, tvd, tvf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,6 +194,6 @@ final class TermVectorsWriter {
|
|||
final void close() throws IOException {
|
||||
// make an effort to close all streams we can but remember and re-throw
|
||||
// the first exception encountered in this process
|
||||
IOUtils.closeSafely(false, tvx, tvd, tvf);
|
||||
IOUtils.close(tvx, tvd, tvf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class BlockTermsWriter extends FieldsConsumer {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, out);
|
||||
IOUtils.closeWhileHandlingException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class BlockTermsWriter extends FieldsConsumer {
|
|||
}
|
||||
writeTrailer(dirStart);
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, out, postingsWriter, termsIndexWriter);
|
||||
IOUtils.close(out, postingsWriter, termsIndexWriter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, indexIn, this);
|
||||
IOUtils.closeWhileHandlingException(indexIn, this);
|
||||
} else if (indexDivisor != -1) {
|
||||
indexIn.close();
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
|
|||
@Override
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
IOUtils.closeSafely(false, in, postingsReader);
|
||||
IOUtils.close(in, postingsReader);
|
||||
} finally {
|
||||
for(FieldReader field : fields.values()) {
|
||||
field.close();
|
||||
|
|
|
@ -171,7 +171,7 @@ public class BlockTreeTermsWriter extends FieldsConsumer {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, out, indexOut);
|
||||
IOUtils.closeWhileHandlingException(out, indexOut);
|
||||
}
|
||||
}
|
||||
this.indexOut = indexOut;
|
||||
|
@ -937,7 +937,7 @@ public class BlockTreeTermsWriter extends FieldsConsumer {
|
|||
} catch (IOException ioe2) {
|
||||
ioe = ioe2;
|
||||
} finally {
|
||||
IOUtils.closeSafely(ioe, out, indexOut, postingsWriter);
|
||||
IOUtils.closeWhileHandlingException(ioe, out, indexOut, postingsWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class DefaultDocValuesProducer extends PerDocValues {
|
|||
} else {
|
||||
toClose = closeables;
|
||||
}
|
||||
IOUtils.closeSafely(false, toClose);
|
||||
IOUtils.close(toClose);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -74,7 +74,7 @@ public class DefaultSegmentInfosWriter extends SegmentInfosWriter {
|
|||
return out;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, out);
|
||||
IOUtils.closeWhileHandlingException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,9 @@ public class FixedGapTermsIndexReader extends TermsIndexReaderBase {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
if (!success) IOUtils.closeSafely(true, in);
|
||||
if (!success) {
|
||||
IOUtils.closeWhileHandlingException(in);
|
||||
}
|
||||
if (indexDivisor > 0) {
|
||||
in.close();
|
||||
in = null;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class FixedGapTermsIndexWriter extends TermsIndexWriterBase {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, out);
|
||||
IOUtils.closeWhileHandlingException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +240,11 @@ public class FixedGapTermsIndexWriter extends TermsIndexWriterBase {
|
|||
writeTrailer(dirStart);
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, out);
|
||||
if (success) {
|
||||
IOUtils.close(out);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ public class VariableGapTermsIndexWriter extends TermsIndexWriterBase {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, out);
|
||||
IOUtils.closeWhileHandlingException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ public final class SepPostingsWriter extends PostingsWriterBase {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, docOut, skipOut, freqOut, posOut, payloadOut);
|
||||
IOUtils.closeWhileHandlingException(docOut, skipOut, freqOut, posOut, payloadOut);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ public final class SepPostingsWriter extends PostingsWriterBase {
|
|||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
IOUtils.closeSafely(false, docOut, skipOut, freqOut, posOut, payloadOut);
|
||||
IOUtils.close(docOut, skipOut, freqOut, posOut, payloadOut);
|
||||
}
|
||||
|
||||
public static void getExtensions(Set<String> extensions) {
|
||||
|
|
|
@ -368,7 +368,7 @@ public final class Bytes {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, datOut);
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ public final class Bytes {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, idxOut);
|
||||
IOUtils.closeWhileHandlingException(idxOut);
|
||||
}
|
||||
}
|
||||
return idxOut;
|
||||
|
|
|
@ -112,7 +112,11 @@ class FixedDerefBytesImpl {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
hash.close();
|
||||
}
|
||||
success = false;
|
||||
|
@ -134,7 +138,11 @@ class FixedDerefBytesImpl {
|
|||
w.finish();
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, idxOut);
|
||||
if (success) {
|
||||
IOUtils.close(idxOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(idxOut);
|
||||
}
|
||||
bytesUsed
|
||||
.addAndGet((-docToID.length) * RamUsageEstimator.NUM_BYTES_INT);
|
||||
docToID = null;
|
||||
|
|
|
@ -126,7 +126,11 @@ class FixedSortedBytesImpl {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
hash.close();
|
||||
}
|
||||
final IndexOutput idxOut = getIndexOut();
|
||||
|
@ -159,7 +163,11 @@ class FixedSortedBytesImpl {
|
|||
}
|
||||
w.finish();
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, idxOut);
|
||||
if (success) {
|
||||
IOUtils.close(idxOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(idxOut);
|
||||
}
|
||||
bytesUsed.addAndGet((-docToEntry.length)
|
||||
* RamUsageEstimator.NUM_BYTES_INT);
|
||||
docToEntry = null;
|
||||
|
|
|
@ -123,7 +123,7 @@ class FixedStraightBytesImpl {
|
|||
try {
|
||||
datOut.copyBytes(cloneData, size * maxDocs);
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, cloneData);
|
||||
IOUtils.close(cloneData);
|
||||
}
|
||||
|
||||
lastDocID += maxDocs;
|
||||
|
@ -133,7 +133,7 @@ class FixedStraightBytesImpl {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,11 @@ class FixedStraightBytesImpl {
|
|||
success = true;
|
||||
} finally {
|
||||
pool.dropBuffersAndReset();
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +235,7 @@ class FixedStraightBytesImpl {
|
|||
data = new byte[maxDoc];
|
||||
datIn.readBytes(data, 0, data.length, false);
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, datIn);
|
||||
IOUtils.close(datIn);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class Floats {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, datOut);
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,11 +214,13 @@ public class Floats {
|
|||
bytesUsed.addAndGet(-(RamUsageEstimator.NUM_BYTES_INT
|
||||
* ((values.length))));
|
||||
values = null;
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Writes 8 bytes (double) per value
|
||||
|
@ -275,7 +277,11 @@ public class Floats {
|
|||
bytesUsed.addAndGet(-(RamUsageEstimator.NUM_BYTES_LONG
|
||||
* ((values.length))));
|
||||
values = null;
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ class IntsImpl {
|
|||
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, datOut);
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,11 @@ class IntsImpl {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
array.clear();
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +290,7 @@ class IntsImpl {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, datIn);
|
||||
IOUtils.closeWhileHandlingException(datIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +305,11 @@ class IntsImpl {
|
|||
datOut.copyBytes(indexInput, bytesPerValue(type) * numDocs);
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, indexInput);
|
||||
if (success) {
|
||||
IOUtils.close(indexInput);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(indexInput);
|
||||
}
|
||||
}
|
||||
return numDocs;
|
||||
}
|
||||
|
@ -323,7 +331,7 @@ class IntsImpl {
|
|||
return source;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, input, datIn);
|
||||
IOUtils.closeWhileHandlingException(input, datIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +353,7 @@ class IntsImpl {
|
|||
return inst;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, input);
|
||||
IOUtils.closeWhileHandlingException(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,7 +184,11 @@ class VarDerefBytesImpl {
|
|||
success = true;
|
||||
} finally {
|
||||
hash.close();
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
|
||||
final IndexOutput idxOut = getIndexOut();
|
||||
|
@ -211,7 +215,11 @@ class VarDerefBytesImpl {
|
|||
w.finish();
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success,idxOut);
|
||||
if (success) {
|
||||
IOUtils.close(idxOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(idxOut);
|
||||
}
|
||||
bytesUsed.addAndGet(RamUsageEstimator.NUM_BYTES_INT
|
||||
* (-docToAddress.length));
|
||||
docToAddress = null;
|
||||
|
|
|
@ -124,7 +124,11 @@ class VarSortedBytesImpl {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
hash.close();
|
||||
}
|
||||
final IndexOutput idxOut = getIndexOut();
|
||||
|
@ -161,7 +165,11 @@ class VarSortedBytesImpl {
|
|||
bytesUsed.addAndGet((-docToEntry.length)
|
||||
* RamUsageEstimator.NUM_BYTES_INT);
|
||||
docToEntry = null;
|
||||
IOUtils.closeSafely(!success, idxOut);
|
||||
if (success) {
|
||||
IOUtils.close(idxOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(idxOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,13 +128,13 @@ class VarStraightBytesImpl {
|
|||
address += numDataBytes; // this is the address after all addr pointers are updated
|
||||
iter.close();
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, cloneIdx);
|
||||
IOUtils.close(cloneIdx);
|
||||
}
|
||||
final IndexInput cloneData = reader.cloneData();
|
||||
try {
|
||||
datOut.copyBytes(cloneData, numDataBytes);
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, cloneData);
|
||||
IOUtils.close(cloneData);
|
||||
}
|
||||
} else {
|
||||
super.merge(state);
|
||||
|
@ -142,7 +142,7 @@ class VarStraightBytesImpl {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,11 @@ class VarStraightBytesImpl {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, datOut);
|
||||
if (success) {
|
||||
IOUtils.close(datOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(datOut);
|
||||
}
|
||||
pool.dropBuffersAndReset();
|
||||
}
|
||||
|
||||
|
@ -204,7 +208,11 @@ class VarStraightBytesImpl {
|
|||
bytesUsed.addAndGet(-(docToAddress.length)
|
||||
* RamUsageEstimator.NUM_BYTES_INT);
|
||||
docToAddress = null;
|
||||
IOUtils.closeSafely(!success, idxOut);
|
||||
if (success) {
|
||||
IOUtils.close(idxOut);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(idxOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public final class CompoundFileDirectory extends Directory {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, handle);
|
||||
IOUtils.closeWhileHandlingException(handle);
|
||||
}
|
||||
}
|
||||
this.isOpen = true;
|
||||
|
@ -112,7 +112,7 @@ public final class CompoundFileDirectory extends Directory {
|
|||
}
|
||||
return mapping;
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, input);
|
||||
IOUtils.close(input);
|
||||
}
|
||||
} else {
|
||||
// TODO remove once 3.x is not supported anymore
|
||||
|
@ -121,7 +121,11 @@ public final class CompoundFileDirectory extends Directory {
|
|||
success = true;
|
||||
return mapping;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, stream);
|
||||
if (success) {
|
||||
IOUtils.close(stream);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,7 +200,7 @@ public final class CompoundFileDirectory extends Directory {
|
|||
assert openForWrite;
|
||||
writer.close();
|
||||
} else {
|
||||
IOUtils.closeSafely(false, handle);
|
||||
IOUtils.close(handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ final class CompoundFileWriter implements Closeable{
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, dataOut);
|
||||
IOUtils.closeWhileHandlingException(dataOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ final class CompoundFileWriter implements Closeable{
|
|||
} catch (IOException e) {
|
||||
priorException = e;
|
||||
} finally {
|
||||
IOUtils.closeSafely(priorException, dataOut);
|
||||
IOUtils.closeWhileHandlingException(priorException, dataOut);
|
||||
}
|
||||
try {
|
||||
entryTableOut = directory.createOutput(entryTableName, IOContext.DEFAULT);
|
||||
|
@ -165,7 +165,7 @@ final class CompoundFileWriter implements Closeable{
|
|||
} catch (IOException e) {
|
||||
priorException = e;
|
||||
} finally {
|
||||
IOUtils.closeSafely(priorException, entryTableOut);
|
||||
IOUtils.closeWhileHandlingException(priorException, entryTableOut);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,13 +205,14 @@ final class CompoundFileWriter implements Closeable{
|
|||
success = true;
|
||||
return length;
|
||||
} finally {
|
||||
IOUtils.closeSafely(!success, is);
|
||||
if (success) {
|
||||
IOUtils.close(is);
|
||||
// copy successful - delete file
|
||||
fileEntry.dir.deleteFile(fileEntry.file);
|
||||
} else {
|
||||
IOUtils.closeWhileHandlingException(is);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void writeEntryTable(Collection<FileEntry> entries,
|
||||
|
|
|
@ -204,7 +204,7 @@ public abstract class Directory implements Closeable {
|
|||
} catch (IOException ioe) {
|
||||
priorException = ioe;
|
||||
} finally {
|
||||
IOUtils.closeSafely(priorException, os, is);
|
||||
IOUtils.closeWhileHandlingException(priorException, os, is);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public final class IOUtils {
|
|||
* @param priorException <tt>null</tt> or an exception that will be rethrown after method completion
|
||||
* @param objects objects to call <tt>close()</tt> on
|
||||
*/
|
||||
public static <E extends Exception> void closeSafely(E priorException, Closeable... objects) throws E, IOException {
|
||||
public static <E extends Exception> void closeWhileHandlingException(E priorException, Closeable... objects) throws E, IOException {
|
||||
Throwable th = null;
|
||||
|
||||
for (Closeable object : objects) {
|
||||
|
@ -76,7 +76,7 @@ public final class IOUtils {
|
|||
}
|
||||
|
||||
/** @see #closeSafely(Exception, Closeable...) */
|
||||
public static <E extends Exception> void closeSafely(E priorException, Iterable<Closeable> objects) throws E, IOException {
|
||||
public static <E extends Exception> void closeWhileHandlingException(E priorException, Iterable<Closeable> objects) throws E, IOException {
|
||||
Throwable th = null;
|
||||
|
||||
for (Closeable object : objects) {
|
||||
|
@ -103,18 +103,16 @@ public final class IOUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Closes all given <tt>Closeable</tt>s, suppressing all thrown exceptions.
|
||||
* Some of the <tt>Closeable</tt>s may be null, they are ignored. After
|
||||
* everything is closed, and if {@code suppressExceptions} is {@code false},
|
||||
* method either throws the first of suppressed exceptions, or completes
|
||||
* normally.
|
||||
* Closes all given <tt>Closeable</tt>s. Some of the
|
||||
* <tt>Closeable</tt>s may be null; they are
|
||||
* ignored. After everything is closed, the method either
|
||||
* throws the first exception it hit while closing, or
|
||||
* completes normally if there were no exceptions.
|
||||
*
|
||||
* @param suppressExceptions
|
||||
* if true then exceptions that occur during close() are suppressed
|
||||
* @param objects
|
||||
* objects to call <tt>close()</tt> on
|
||||
*/
|
||||
public static void closeSafely(boolean suppressExceptions, Closeable... objects) throws IOException {
|
||||
public static void close(Closeable... objects) throws IOException {
|
||||
Throwable th = null;
|
||||
|
||||
for (Closeable object : objects) {
|
||||
|
@ -124,12 +122,13 @@ public final class IOUtils {
|
|||
}
|
||||
} catch (Throwable t) {
|
||||
addSuppressed(th, t);
|
||||
if (th == null)
|
||||
if (th == null) {
|
||||
th = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (th != null && !suppressExceptions) {
|
||||
if (th != null) {
|
||||
if (th instanceof IOException) throw (IOException) th;
|
||||
if (th instanceof RuntimeException) throw (RuntimeException) th;
|
||||
if (th instanceof Error) throw (Error) th;
|
||||
|
@ -138,9 +137,9 @@ public final class IOUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see #closeSafely(boolean, Closeable...)
|
||||
* @see #close(Closeable...)
|
||||
*/
|
||||
public static void closeSafely(boolean suppressExceptions, Iterable<? extends Closeable> objects) throws IOException {
|
||||
public static void close(Iterable<? extends Closeable> objects) throws IOException {
|
||||
Throwable th = null;
|
||||
|
||||
for (Closeable object : objects) {
|
||||
|
@ -150,12 +149,13 @@ public final class IOUtils {
|
|||
}
|
||||
} catch (Throwable t) {
|
||||
addSuppressed(th, t);
|
||||
if (th == null)
|
||||
if (th == null) {
|
||||
th = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (th != null && !suppressExceptions) {
|
||||
if (th != null) {
|
||||
if (th instanceof IOException) throw (IOException) th;
|
||||
if (th instanceof RuntimeException) throw (RuntimeException) th;
|
||||
if (th instanceof Error) throw (Error) th;
|
||||
|
@ -163,6 +163,38 @@ public final class IOUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all given <tt>Closeable</tt>s, suppressing all thrown exceptions.
|
||||
* Some of the <tt>Closeable</tt>s may be null, they are ignored.
|
||||
*
|
||||
* @param objects
|
||||
* objects to call <tt>close()</tt> on
|
||||
*/
|
||||
public static void closeWhileHandlingException(Closeable... objects) throws IOException {
|
||||
for (Closeable object : objects) {
|
||||
try {
|
||||
if (object != null) {
|
||||
object.close();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #closeSafely(boolean, Closeable...)
|
||||
*/
|
||||
public static void closeWhileHandlingException(Iterable<? extends Closeable> objects) throws IOException {
|
||||
for (Closeable object : objects) {
|
||||
try {
|
||||
if (object != null) {
|
||||
object.close();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** This reflected {@link Method} is {@code null} before Java 7 */
|
||||
private static final Method SUPPRESS_METHOD;
|
||||
static {
|
||||
|
|
|
@ -119,7 +119,7 @@ public class MockFixedIntBlockCodec extends Codec {
|
|||
return ret;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, out);
|
||||
IOUtils.closeWhileHandlingException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public class MockVariableIntBlockCodec extends Codec {
|
|||
return ret;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, out);
|
||||
IOUtils.closeWhileHandlingException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class MockSingleIntIndexOutput extends IntIndexOutput {
|
|||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeSafely(true, out);
|
||||
IOUtils.closeWhileHandlingException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class PreFlexFieldsWriter extends FieldsConsumer {
|
|||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
IOUtils.closeSafely(false, termsOut, freqOut, proxOut);
|
||||
IOUtils.close(termsOut, freqOut, proxOut);
|
||||
}
|
||||
|
||||
private class PreFlexTermsWriter extends TermsConsumer {
|
||||
|
|
|
@ -98,7 +98,7 @@ final class TermInfosWriter implements Closeable {
|
|||
} finally {
|
||||
if (!success) {
|
||||
try {
|
||||
IOUtils.closeSafely(true, output);
|
||||
IOUtils.closeWhileHandlingException(output);
|
||||
} catch (IOException e) {
|
||||
// cannot happen since we suppress exceptions
|
||||
throw new RuntimeException(e);
|
||||
|
@ -139,7 +139,7 @@ final class TermInfosWriter implements Closeable {
|
|||
} finally {
|
||||
if (!success) {
|
||||
try {
|
||||
IOUtils.closeSafely(true, output);
|
||||
IOUtils.closeWhileHandlingException(output);
|
||||
} catch (IOException e) {
|
||||
// cannot happen since we suppress exceptions
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
@ -541,7 +541,7 @@ public class TestTermVectors extends LuceneTestCase {
|
|||
|
||||
verifyIndex(target);
|
||||
|
||||
IOUtils.closeSafely(false, target, input[0], input[1]);
|
||||
IOUtils.close(target, input[0], input[1]);
|
||||
}
|
||||
|
||||
public void testOptimizeAddIndexesReader() throws Exception {
|
||||
|
@ -562,7 +562,7 @@ public class TestTermVectors extends LuceneTestCase {
|
|||
writer.close();
|
||||
|
||||
verifyIndex(target);
|
||||
IOUtils.closeSafely(false, target, input[0], input[1]);
|
||||
IOUtils.close(target, input[0], input[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class TestIOUtils extends LuceneTestCase {
|
|||
// test with prior exception
|
||||
try {
|
||||
final TestException t = new TestException();
|
||||
IOUtils.closeSafely(t, new BrokenCloseable(1), new BrokenCloseable(2));
|
||||
IOUtils.closeWhileHandlingException(t, new BrokenCloseable(1), new BrokenCloseable(2));
|
||||
} catch (TestException e1) {
|
||||
assertEquals("BASE-EXCEPTION", e1.getMessage());
|
||||
final StringWriter sw = new StringWriter();
|
||||
|
@ -83,7 +83,7 @@ public class TestIOUtils extends LuceneTestCase {
|
|||
|
||||
// test without prior exception
|
||||
try {
|
||||
IOUtils.closeSafely((TestException) null, new BrokenCloseable(1), new BrokenCloseable(2));
|
||||
IOUtils.closeWhileHandlingException((TestException) null, new BrokenCloseable(1), new BrokenCloseable(2));
|
||||
} catch (TestException e1) {
|
||||
fail("TestException should not be thrown here");
|
||||
} catch (IOException e2) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase {
|
|||
searcher.close();
|
||||
iw.close();
|
||||
tw.close();
|
||||
IOUtils.closeSafely(false, dirs[0]);
|
||||
IOUtils.close(dirs[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -140,7 +140,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase {
|
|||
searcher.close();
|
||||
iw.close();
|
||||
tw.close();
|
||||
IOUtils.closeSafely(false, dirs[0]);
|
||||
IOUtils.close(dirs[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -184,7 +184,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase {
|
|||
searcher.close();
|
||||
iw.close();
|
||||
tw.close();
|
||||
IOUtils.closeSafely(false, dirs[0]);
|
||||
IOUtils.close(dirs[0]);
|
||||
}
|
||||
|
||||
private void assertPostingListExists(String field, String text, IndexReader ir) throws IOException {
|
||||
|
@ -230,7 +230,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase {
|
|||
searcher.close();
|
||||
iw.close();
|
||||
tw.close();
|
||||
IOUtils.closeSafely(false, dirs[0]);
|
||||
IOUtils.close(dirs[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -275,7 +275,7 @@ public class TestMultipleCategoryLists extends LuceneTestCase {
|
|||
searcher.close();
|
||||
iw.close();
|
||||
tw.close();
|
||||
IOUtils.closeSafely(false, dirs[0]);
|
||||
IOUtils.close(dirs[0]);
|
||||
}
|
||||
|
||||
private Directory[][] getDirs() throws IOException {
|
||||
|
|
|
@ -109,7 +109,7 @@ public class TestTotalFacetCounts extends LuceneTestCase {
|
|||
++partition;
|
||||
}
|
||||
readers[0].close();
|
||||
IOUtils.closeSafely(false, dirs[0]);
|
||||
IOUtils.close(dirs[0]);
|
||||
tmpFile.delete();
|
||||
}
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ public class TestTotalFacetCountsCache extends LuceneTestCase {
|
|||
readers[0].close();
|
||||
r2.close();
|
||||
outputFile.delete();
|
||||
IOUtils.closeSafely(false, dirs[0]);
|
||||
IOUtils.close(dirs[0]);
|
||||
}
|
||||
|
||||
private int assertReadFromDisc(TotalFacetCounts totalCounts, int prevGen, String errMsg) {
|
||||
|
@ -405,7 +405,7 @@ public class TestTotalFacetCountsCache extends LuceneTestCase {
|
|||
outputFile.delete();
|
||||
writers[0].close();
|
||||
readers[0].close();
|
||||
IOUtils.closeSafely(false, dirs[0]);
|
||||
IOUtils.close(dirs[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -535,7 +535,7 @@ public class TestTotalFacetCountsCache extends LuceneTestCase {
|
|||
readers[0].close();
|
||||
readers[1].close();
|
||||
for (Directory[] dirset : dirs) {
|
||||
IOUtils.closeSafely(false, dirset);
|
||||
IOUtils.close(dirset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -247,8 +247,8 @@ public class TestAddTaxonomies extends LuceneTestCase {
|
|||
}
|
||||
|
||||
main.close();
|
||||
IOUtils.closeSafely(false, dirs);
|
||||
IOUtils.closeSafely(false, copydirs);
|
||||
IOUtils.close(dirs);
|
||||
IOUtils.close(copydirs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ public class FSTLookup extends Lookup {
|
|||
this.automaton = new FST<Object>(new InputStreamDataInput(is), NoOutputs.getSingleton());
|
||||
cacheRootArcs();
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, is);
|
||||
IOUtils.close(is);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ public class FSTLookup extends Lookup {
|
|||
try {
|
||||
this.automaton.save(new OutputStreamDataOutput(os));
|
||||
} finally {
|
||||
IOUtils.closeSafely(false, os);
|
||||
IOUtils.close(os);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -247,7 +247,7 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
|||
if (solrCore != null) solrCore.close();
|
||||
}
|
||||
}
|
||||
if (readersToBeClosed != null) IOUtils.closeSafely(true, readersToBeClosed);
|
||||
if (readersToBeClosed != null) IOUtils.closeWhileHandlingException(readersToBeClosed);
|
||||
if (dirsToBeReleased != null) {
|
||||
for (Directory dir : dirsToBeReleased) {
|
||||
DirectoryFactory dirFactory = core.getDirectoryFactory();
|
||||
|
|
Loading…
Reference in New Issue