Apache Lucene open-source search software
LUCENE-6637: Fix FSTTester to not violate file permissions on -Dtests.verbose=true
Uwe Schindler4b758ee3fe72
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 3c97636019a..857ae8e2077 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -254,6 +254,11 @@ Build* LUCENE-6568: Make rat invocation depend on ivy configuration being set up(Ramkumar Aiyengar)+Test Framework++* LUCENE-6637: Fix FSTTester to not violate file permissions on+ -Dtests.verbose=true. (Mesbah M. Alam, Uwe Schindler)+Changes in Backwards Compatibility Policy* LUCENE-6553: The iterator returned by the LeafReader.postings method nowdiff --git a/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java b/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.javaindex 5393a48ad80..15d832c4e40 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java@@ -18,10 +18,9 @@ package org.apache.lucene.util.fst;*/import java.io.IOException;+import java.io.OutputStreamWriter;import java.io.Writer;-import java.nio.charset.StandardCharsets;-import java.nio.file.Files;-import java.nio.file.Paths;+import java.nio.charset.Charset;import java.util.ArrayList;import java.util.Collections;import java.util.HashMap;@@ -321,10 +320,11 @@ public class FSTTester<T> {}if (LuceneTestCase.VERBOSE && pairs.size() <= 20 && fst != null) {- Writer w = Files.newBufferedWriter(Paths.get("out.dot"), StandardCharsets.UTF_8);+ System.out.println("Printing FST as dot file to stdout:");+ final Writer w = new OutputStreamWriter(System.out, Charset.defaultCharset());Util.toDot(fst, w, false, false);- w.close();- System.out.println("SAVED out.dot");+ w.flush();+ System.out.println("END dot file");}if (LuceneTestCase.VERBOSE) {