Skip to content

Commit 97f80c1

Browse files
committed
Fix FST not readable error in test
1 parent 98a9d90 commit 97f80c1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lucene/core/src/java/org/apache/lucene/util/fst/FST.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ public FST(FSTMetadata<T> metadata, DataInput in, FSTStore fstStore) throws IOEx
417417

418418
/** Create the FST with a metadata object and a FSTReader. */
419419
public FST(FSTMetadata<T> metadata, FSTReader fstReader) {
420+
assert metadata != null;
420421
this.metadata = metadata;
421422
this.outputs = metadata.outputs;
422423
this.fstReader = fstReader;

lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,6 @@ public void testNonFinalStopNode() throws Exception {
12521252
final Long nothing = outputs.getNoOutput();
12531253
final FSTCompiler<Long> fstCompiler =
12541254
new FSTCompiler.Builder<>(FST.INPUT_TYPE.BYTE1, outputs).build();
1255-
final FST<Long> fst = fstCompiler.fst;
12561255

12571256
final FSTCompiler.UnCompiledNode<Long> rootNode =
12581257
new FSTCompiler.UnCompiledNode<>(fstCompiler, 0);
@@ -1285,6 +1284,8 @@ public void testNonFinalStopNode() throws Exception {
12851284

12861285
fstCompiler.finish(fstCompiler.addNode(rootNode));
12871286

1287+
final FST<Long> fst = new FST<>(fstCompiler.fst.metadata, fstCompiler.getFSTReader());
1288+
12881289
StringWriter w = new StringWriter();
12891290
// Writer w = new OutputStreamWriter(new FileOutputStream("/x/tmp3/out.dot"));
12901291
Util.toDot(fst, w, false, false);

0 commit comments

Comments
 (0)