[ 
https://issues.apache.org/jira/browse/LUCENE-5926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14123314#comment-14123314
 ] 

Robert Muir commented on LUCENE-5926:
-------------------------------------

+1

I think a bunch of these have asserts just because i got frustrated in test 
bugs. they should all be real checks. 

> ResourceLoaderAware classes should probably throw IllegalStateException if 
> you attempt to use them w/o calling inform()
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-5926
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5926
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Hoss Man
>
> Mailing list user reported an NPE from SnowballPorterFilterFactory.create 
> that was ultimately caused by not realizing that they had to call 
> SnowballPorterFilterFactory.inform.
> We should consider updating all ResourceLoaderAware classes so that if you 
> attempt to use them w/o calling inform, you consistently get an 
> IllegalStateException w/meaningful error.
> ie, in the case of SnowballPorterFilterFactory, something like...
> {noformat}
>   @Override
>   public TokenFilter create(TokenStream input) {
>     if (null == stemClass) {
>       throw new IllegalStateException("inform(ResourceLoader) method must be 
> called before using this factory");
>     }
>     ...
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to