Skip to content

Apache Lucene open-source search software

LUCENE-2933: Correcting test case calling toDot().

Dawid Weiss11bc3414131f
diff --git a/lucene/src/test/org/apache/lucene/util/automaton/fst/TestFSTs.java b/lucene/src/test/org/apache/lucene/util/automaton/fst/TestFSTs.java
index 39dc27be1e2..f979481306e 100644
--- a/lucene/src/test/org/apache/lucene/util/automaton/fst/TestFSTs.java
+++ b/lucene/src/test/org/apache/lucene/util/automaton/fst/TestFSTs.java
@@ -20,9 +20,11 @@ package org.apache.lucene.util.automaton.fst;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.PrintStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -445,9 +447,9 @@ public class TestFSTs extends LuceneTestCase {
}
if (VERBOSE && pairs.size() <= 20 && fst != null) {
- PrintStream ps = new PrintStream("out.dot");
- Util.toDot(fst, ps);
- ps.close();
+ Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), "UTF-8");
+ Util.toDot(fst, w, false, false);
+ w.close();
System.out.println("SAVED out.dot");
}
@@ -1128,9 +1130,9 @@ public class TestFSTs extends LuceneTestCase {
System.out.println(ord + " terms; " + fst.getNodeCount() + " nodes; " + fst.getArcCount() + " arcs; " + fst.getArcWithOutputCount() + " arcs w/ output; tot size " + fst.sizeInBytes());
if (fst.getNodeCount() < 100) {
- PrintStream ps = new PrintStream("out.dot");
- Util.toDot(fst, ps);
- ps.close();
+ Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), "UTF-8");
+ Util.toDot(fst, w, false, false);
+ w.close();
System.out.println("Wrote FST to out.dot");
}