LUCENE-1140 patch to fix StandardAnalyzer stop set NPE and test

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@613282 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Grant Ingersoll 2008-01-18 21:28:05 +00:00
parent ed9fdba601
commit 82980ed7c4
3 changed files with 12 additions and 0 deletions

View File

@ -228,6 +228,7 @@ Bug fixes
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)

View File

@ -85,6 +85,7 @@ public class StandardAnalyzer extends Analyzer {
* @deprecated Remove in 3.X and make true the only valid value
*/
public StandardAnalyzer(boolean replaceInvalidAcronym) {
this(STOP_WORDS);
this.replaceInvalidAcronym = replaceInvalidAcronym;
}

View File

@ -120,6 +120,16 @@ public class TestStandardAnalyzer extends LuceneTestCase {
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"});