You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by gs...@apache.org on 2008/01/18 22:27:11 UTC

svn commit: r613280 - in /lucene/java/branches/lucene_2_3: CHANGES.txt src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java

Author: gsingers
Date: Fri Jan 18 13:27:10 2008
New Revision: 613280

URL: http://svn.apache.org/viewvc?rev=613280&view=rev
Log:
LUCENE-1140 patch to fix StandardAnalyzer stop set NPE and test

Modified:
    lucene/java/branches/lucene_2_3/CHANGES.txt
    lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java
    lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java

Modified: lucene/java/branches/lucene_2_3/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_3/CHANGES.txt?rev=613280&r1=613279&r2=613280&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_3/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_3/CHANGES.txt Fri Jan 18 13:27:10 2008
@@ -210,6 +210,7 @@
   replaceInvalidAcronym which defaults to false, the current, incorrect behavior.  Setting
   this flag to true fixes the problem.  This flag is a temporary fix and is already
   marked as being deprecated.  3.x will implement the correct approach.  (Shai Erera via Grant Ingersoll)
+  LUCENE-1140: Fixed NPE caused by 1068 (Alexei Dets via Grant Ingersoll)
     
 28. LUCENE-749: ChainedFilter behavior fixed when logic of 
     first filter is ANDNOT.  (Antonio Bruno via Doron Cohen)

Modified: lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java?rev=613280&r1=613279&r2=613280&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java (original)
+++ lucene/java/branches/lucene_2_3/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java Fri Jan 18 13:27:10 2008
@@ -85,6 +85,7 @@
    * @deprecated Remove in 3.X and make true the only valid value
    */
   public StandardAnalyzer(boolean replaceInvalidAcronym) {
+    this(STOP_WORDS);
     this.replaceInvalidAcronym = replaceInvalidAcronym;
   }
 

Modified: lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java?rev=613280&r1=613279&r2=613280&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java (original)
+++ lucene/java/branches/lucene_2_3/src/test/org/apache/lucene/analysis/TestStandardAnalyzer.java Fri Jan 18 13:27:10 2008
@@ -120,6 +120,16 @@
     assertAnalyzesTo(a, "Excite@Home", new String[]{"excite@home"});
   }
 
+  public void testLucene1140() throws Exception {
+    try {
+      StandardAnalyzer analyzer = new StandardAnalyzer(true);
+      assertAnalyzesTo(analyzer, "www.nutch.org.", new String[]{ "www.nutch.org" }, new String[] { "<HOST>" });
+    } catch (NullPointerException e) {
+      assertTrue("Should not throw an NPE and it did", false);
+    }
+
+  }
+
   public void testDomainNames() throws Exception {
     // domain names
     assertAnalyzesTo(a, "www.nutch.org", new String[]{"www.nutch.org"});