Fix a bug, which caused the full-text files to never close.

This commit is contained in:
Lampros Smyrnaios 2023-05-04 13:03:28 +03:00
parent 3473d91ce4
commit b3196376eb
1 changed files with 5 additions and 4 deletions

View File

@ -40,10 +40,11 @@ public class FileDecompressor {
while ( ((entry = (TarArchiveEntry) tarInput.getNextEntry()) != null) )
{
// Copy an individual entry.
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(Files.newOutputStream(targetDir.resolve(entry.getName())), FileUtils.tenMb);
while ( (readByte = tarInput.read()) != -1 )
bufferedOutputStream.write(readByte);
// No need to close the tarEntry.
try ( BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(Files.newOutputStream(targetDir.resolve(entry.getName())), FileUtils.tenMb) ) {
while ( (readByte = tarInput.read()) != -1 )
bufferedOutputStream.write(readByte);
} // The exception will be given to the caller method.
// No need to close the tarEntry (no "close()" method is provided).
}
}