Apache Lucene open-source search software
LUCENE-5621: Let DirectPF and RAMOutputStream wreak havoc together if they like
Robert Muir07f581771542
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.javaindex ab1009a5175..d33ccc2f50f 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java@@ -383,6 +383,7 @@ public final class DirectPostingsFormat extends PostingsFormat {final byte[] payloads;if (hasPayloads) {+ ros.flush();payloads = new byte[(int) ros.getFilePointer()];ros.writeTo(payloads, 0);} else {diff --git a/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java b/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.javaindex 0a56508ed3d..adcdc14b353 100644--- a/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java+++ b/lucene/core/src/java/org/apache/lucene/store/RAMOutputStream.java@@ -155,7 +155,9 @@ public class RAMOutputStream extends IndexOutput {}/** Forces any buffered output to be written. */- protected void flush() throws IOException {+ // TODO: remove 'public'. Something bogus is happening between this guy and DirectPF,+ // not sure which one (or maybe both?) has the bug.+ public void flush() throws IOException {setFileLength();}