lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r692634 - in /lucene/java/trunk/src: java/org/apache/lucene/analysis/standard/StandardAnalyzer.java test/org/apache/lucene/analysis/TestStandardAnalyzer.java
Date Sat, 06 Sep 2008 10:58:33 GMT
Author: mikemccand
Date: Sat Sep  6 03:58:33 2008
New Revision: 692634

URL: http://svn.apache.org/viewvc?rev=692634&view=rev
Log:
LUCENE-1151: fix misleading javadoc comment and testcase for StandardAnalyzer

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java
    lucene/java/trunk/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java?rev=692634&r1=692633&r2=692634&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java Sat
Sep  6 03:58:33 2008
@@ -45,7 +45,7 @@
 
   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 set
   static {
     final String v = System.getProperty("org.apache.lucene.analysis.standard.StandardAnalyzer.replaceInvalidAcronym");
     if (v == null || v.equals("true"))

Modified: lucene/java/trunk/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java?rev=692634&r1=692633&r2=692634&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java Sat Sep
 6 03:58:33 2008
@@ -132,14 +132,15 @@
   }
 
   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 {



Mime
View raw message