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

Uwe Schindler commented on LUCENE-10353:
----------------------------------------

This is one example I found on first try:

{noformat}
org.apache.lucene.analysis.tests.TestRandomChains > test suite's output saved 
to C:\Users\Uwe 
Schindler\Projects\lucene\lucene\lucene\analysis\integration.tests\build\test-results\test_13\outputs\OUTPUT-org.apache.lucene.analysis.tests.TestRandomChains.txt,
 copied below:
  2> Exception from random analyzer:
  2> charfilters=
  2> tokenizer=
  2>   
org.apache.lucene.analysis.cn.smart.HMMChineseTokenizer(org.apache.lucene.util.AttributeFactory$1@17a9e257)
  2> filters=
  2>   
org.apache.lucene.analysis.ga.IrishLowerCaseFilter(ValidatingTokenFilter@2a2997e5
 
term=,bytes=[],startOffset=0,endOffset=0,positionIncrement=1,positionLength=1,type=word,termFrequency=1,flags=0,payload=null)
  2>   
org.apache.lucene.analysis.core.TypeTokenFilter(ValidatingTokenFilter@2f97a7e9 
term=,bytes=[],startOffset=0,endOffset=0,positionIncrement=1,positionLength=1,type=word,termFrequency=1,flags=0,payload=null,
 null, false)
   >     java.lang.NullPointerException
   >         at 
__randomizedtesting.SeedInfo.seed([C2D9E35FB4E64795:A8825C4EEDA86766]:0)
   >         at 
org.apache.lucene.analysis.common@10.0.0-SNAPSHOT/org.apache.lucene.analysis.core.TypeTokenFilter.accept(TypeTokenFilter.java:56)
   >         at 
org.apache.lucene.core@10.0.0-SNAPSHOT/org.apache.lucene.analysis.FilteringTokenFilter.incrementToken(FilteringTokenFilter.java:52)
{noformat}

> Add null injection to analyzer integration tests (e.g. TestRandomChains)
> ------------------------------------------------------------------------
>
>                 Key: LUCENE-10353
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10353
>             Project: Lucene - Core
>          Issue Type: Task
>            Reporter: Robert Muir
>            Assignee: Uwe Schindler
>            Priority: Major
>
> These tests inject random parameter values (from argumentProviders). Some 
> generated values may be illegal and IllegalArgumentException is "allowed" if 
> the constructor returns it. None of the values should cause failures at 
> runtime.
> But for object types, we never inject null values (unless the 
> argumentProvider were to do it itself). We should do this some low % of the 
> time, and "allow" ctors to return NPE too.
> I see bugs in some of the analyzers where they are just a missing null check 
> in the constructor. It is important to fail on invalid configuration up-front 
> in the ctor, rather than failing e.g. at index time.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to