Jack Krupansky created SOLR-4366: ------------------------------------ Summary: NPE sometimes in SpellCheckComponent when dictionary name not defined Key: SOLR-4366 URL: https://issues.apache.org/jira/browse/SOLR-4366 Project: Solr Issue Type: Bug Components: spellchecker Affects Versions: 4.0 Reporter: Jack Krupansky
SpellCheckComponent sometimes detects and reports dictionary names that are not defined, but not always. I stumbled on two cases where an NPE occurs rather than a 404 status code return. Repro: Add this snippet to the Solr 4.0 example solrconfig.xml: {code} <requestHandler name="/spellBug" class="solr.SearchHandler" startup="lazy"> <lst name="defaults"> <str name="df">name</str> <str name="spellcheck">on</str> <str name="spellcheck.dictionary">other-name</str> </lst> <arr name="last-components"> <str>spellcheckBug</str> </arr> </requestHandler> <searchComponent name="spellcheckBug" class="solr.SpellCheckComponent"> <lst name="spellchecker"> <str name="name">some-name</str> <str name="classname">solr.FileBasedSpellChecker</str> <str name="sourceLocation">SpellDict.txt</str> <str name="buildOnCommit">true</str> </lst> </searchComponent> {code} Case 1: spellcheck.build=true parameter specified Execute this request: {code} curl "http://localhost:8983/solr/spellBug/?q=test&spellcheck.build=true" {code} Produces this NPE: {code} SEVERE: null:java.lang.NullPointerException at org.apache.solr.handler.component.SpellCheckComponent.prepare(SpellCheckComponent.java:108) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:185) {code} Case 1a: Ditto for spellcheck.reload parameter specified {code} curl "http://localhost:8983/solr/spellBug/?q=test&spellcheck.reload=true" {code} Case 2: spellcheck.q parameter specified Execute this request: {code} curl "http://localhost:8983/solr/spellBug/?spellcheck.q=test" {code} Produces this NPE: {code} SEVERE: null:java.lang.NullPointerException at org.apache.solr.handler.component.SpellCheckComponent.process(SpellCheckComponent.java:130) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:206) {code} The first case fails in the "prepare" method of SpellCheckComponent, while the second case fails in the "process" method. Both methods call getSpellChecker, but then proceed to reference the return value without checking if it is null. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org