You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2014/12/31 16:53:13 UTC
svn commit: r1648725 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/CHANGES.txt lucene/core/
lucene/core/src/java/org/apache/lucene/store/OutputStreamIndexOutput.java
Author: uschindler
Date: Wed Dec 31 15:53:12 2014
New Revision: 1648725
URL: http://svn.apache.org/r1648725
Log:
Merged revision(s) 1648724 from lucene/dev/trunk:
LUCENE-6152: Fix double close bug in OutputStreamIndexOutput
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/lucene/core/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/OutputStreamIndexOutput.java
Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1648725&r1=1648724&r2=1648725&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Wed Dec 31 15:53:12 2014
@@ -382,6 +382,9 @@ Bug Fixes
* LUCENE-6124: Fix double-close() problems in codec and store APIs.
(Robert Muir)
+* LUCENE-6152: Fix double close problems in OutputStreamIndexOutput.
+ (Uwe Schindler)
+
Documentation
* LUCENE-5392: Add/improve analysis package documentation to reflect
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/OutputStreamIndexOutput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/OutputStreamIndexOutput.java?rev=1648725&r1=1648724&r2=1648725&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/OutputStreamIndexOutput.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/OutputStreamIndexOutput.java Wed Dec 31 15:53:12 2014
@@ -30,6 +30,7 @@ public class OutputStreamIndexOutput ext
private final BufferedOutputStream os;
private long bytesWritten = 0L;
+ private boolean flushedOnClose = false;
/**
* Creates a new {@link OutputStreamIndexOutput} with the given buffer size.
@@ -58,9 +59,14 @@ public class OutputStreamIndexOutput ext
try (final OutputStream o = os) {
// We want to make sure that os.flush() was running before close:
// BufferedOutputStream may ignore IOExceptions while flushing on close().
- // TODO: this is no longer an issue in Java 8:
- // http://hg.openjdk.java.net/jdk8/tl/jdk/rev/759aa847dcaf
- o.flush();
+ // We keep this also in Java 8, although it claims to be fixed there,
+ // because there are more bugs around this! See:
+ // # https://bugs.openjdk.java.net/browse/JDK-7015589
+ // # https://bugs.openjdk.java.net/browse/JDK-8054565
+ if (!flushedOnClose) {
+ flushedOnClose = true; // set this BEFORE calling flush!
+ o.flush();
+ }
}
}