Apache Lucene open-source search software
LUCENE-1151: fix misleading javadoc comment and testcase for StandardAnalyzer
Michael McCandless6242cb3322d9
diff --git a/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java b/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.javaindex 0ed1289d341..a168c4fb3cb 100644--- a/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java+++ b/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java@@ -45,7 +45,7 @@ public class StandardAnalyzer extends Analyzer {private static boolean defaultReplaceInvalidAcronym;- // Default to false (fixed the bug), unless the system prop is set+ // Default to true (fixed the bug), unless the system prop is setstatic {final String v = System.getProperty("org.apache.lucene.analysis.standard.StandardAnalyzer.replaceInvalidAcronym");if (v == null || v.equals("true"))diff --git a/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java b/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.javaindex d5d7422a2a3..7be044c5852 100644--- a/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java+++ b/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java@@ -132,14 +132,15 @@ public class TestStandardAnalyzer extends LuceneTestCase {}public void testDomainNames() throws Exception {+ // Don't reuse a because we alter its state (setReplaceInvalidAcronym)+ StandardAnalyzer a2 = new StandardAnalyzer();// domain names- assertAnalyzesTo(a, "www.nutch.org", new String[]{"www.nutch.org"});+ assertAnalyzesTo(a2, "www.nutch.org", new String[]{"www.nutch.org"});//Notice the trailing . See https://issues.apache.org/jira/browse/LUCENE-1068.// the following should be recognized as HOST:- assertAnalyzesTo(a, "www.nutch.org.", new String[]{ "www.nutch.org" }, new String[] { "<HOST>" });- ((StandardAnalyzer) a).setReplaceInvalidAcronym(false);- assertAnalyzesTo(a, "www.nutch.org.", new String[]{ "wwwnutchorg" }, new String[] { "<ACRONYM>" });- ((StandardAnalyzer) a).setReplaceInvalidAcronym(true);+ assertAnalyzesTo(a2, "www.nutch.org.", new String[]{ "www.nutch.org" }, new String[] { "<HOST>" });+ a2.setReplaceInvalidAcronym(false);+ assertAnalyzesTo(a2, "www.nutch.org.", new String[]{ "wwwnutchorg" }, new String[] { "<ACRONYM>" });}public void testEMailAddresses() throws Exception {