FST.save can truncate output (BufferedOutputStream may be closed after the underlying stream)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1668551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2015-03-23 08:47:33 +00:00
parent e893b4dd54
commit 425c57b22f
2 changed files with 5 additions and 2 deletions

View File

@ -64,6 +64,9 @@ New Features
Bug Fixes
* LUCENE-6368: FST.save can truncate output (BufferedOutputStream may be closed
after the underlying stream). (Ippei Matsushima via Dawid Weiss)
* LUCENE-6249: StandardQueryParser doesn't support pure negative clauses.
(Dawid Weiss)

View File

@ -605,8 +605,8 @@ public final class FST<T> implements Accountable {
* Writes an automaton to a file.
*/
public void save(final Path path) throws IOException {
try (OutputStream os = Files.newOutputStream(path)) {
save(new OutputStreamDataOutput(new BufferedOutputStream(os)));
try (OutputStream os = new BufferedOutputStream(Files.newOutputStream(path))) {
save(new OutputStreamDataOutput(os));
}
}