You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2011/07/21 01:07:39 UTC
svn commit: r1148968 - in /lucene/dev/trunk/lucene: CHANGES.txt
src/test/org/apache/lucene/util/fst/TestFSTs.java
Author: mikemccand
Date: Wed Jul 20 23:07:38 2011
New Revision: 1148968
URL: http://svn.apache.org/viewvc?rev=1148968&view=rev
Log:
LUCENE-3327: fix AIOOBE in test case when verbose is true
Modified:
lucene/dev/trunk/lucene/CHANGES.txt
lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java
Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1148968&r1=1148967&r2=1148968&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Wed Jul 20 23:07:38 2011
@@ -559,6 +559,11 @@ Optimizations
greatly reduce RAM required during building, and CPU consumed, at
the cost of a somewhat larger FST. (Mike McCandless)
+Test Cases
+
+* LUCENE-3327: Fix AIOOBE when TestFSTs is run with
+ -Dtests.verbose=true (James Dyer via Mike McCandless)
+
======================= Lucene 3.3.0 =======================
Changes in backwards compatibility policy
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1148968&r1=1148967&r2=1148968&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java Wed Jul 20 23:07:38 2011
@@ -830,7 +830,7 @@ public class TestFSTs extends LuceneTest
final IntsRef prefix = ent.getKey();
final CountMinOutput<T> cmo = ent.getValue();
if (VERBOSE) {
- System.out.println(" term=" + inputToString(inputMode, prefix) + " count=" + cmo.count + " isLeaf=" + cmo.isLeaf + " output=" + outputs.outputToString(cmo.output) + " isFinal=" + cmo.isFinal);
+ System.out.println(" term prefix=" + inputToString(inputMode, prefix, false) + " count=" + cmo.count + " isLeaf=" + cmo.isLeaf + " output=" + outputs.outputToString(cmo.output) + " isFinal=" + cmo.isFinal);
}
final boolean keep;
if (prune1 > 0) {
@@ -897,7 +897,7 @@ public class TestFSTs extends LuceneTest
IntsRefFSTEnum.InputOutput<T> current;
while((current = fstEnum.next()) != null) {
if (VERBOSE) {
- System.out.println(" fstEnum.next term=" + inputToString(inputMode, current.input) + " output=" + outputs.outputToString(current.output));
+ System.out.println(" fstEnum.next prefix=" + inputToString(inputMode, current.input, false) + " output=" + outputs.outputToString(current.output));
}
final CountMinOutput cmo = prefixes.get(current.input);
assertNotNull(cmo);
@@ -920,7 +920,7 @@ public class TestFSTs extends LuceneTest
final CountMinOutput<T> cmo = ent.getValue();
final T output = run(fst, ent.getKey(), stopNode);
if (VERBOSE) {
- System.out.println("TEST: verify term=" + inputToString(inputMode, ent.getKey()) + " output=" + outputs.outputToString(cmo.output));
+ System.out.println("TEST: verify prefix=" + inputToString(inputMode, ent.getKey(), false) + " output=" + outputs.outputToString(cmo.output));
}
// if (cmo.isFinal && !cmo.isLeaf) {
if (cmo.isFinal) {
@@ -982,9 +982,15 @@ public class TestFSTs extends LuceneTest
public void testBigSet() throws IOException {
testRandomWords(_TestUtil.nextInt(random, 50000, 60000), 1);
}
-
+
private static String inputToString(int inputMode, IntsRef term) {
- if (inputMode == 0) {
+ return inputToString(inputMode, term, true);
+ }
+
+ private static String inputToString(int inputMode, IntsRef term, boolean isValidUnicode) {
+ if (!isValidUnicode) {
+ return term.toString();
+ } else if (inputMode == 0) {
// utf8
return toBytesRef(term).utf8ToString() + " " + term;
} else {