Trejkaz created LUCENE-6655:
-------------------------------

             Summary: StandardTokenizerFactory constructor fails if the passed 
in map is immutable
                 Key: LUCENE-6655
                 URL: https://issues.apache.org/jira/browse/LUCENE-6655
             Project: Lucene - Core
          Issue Type: Bug
    Affects Versions: 5.1
            Reporter: Trejkaz


One of our tests tried to initialise a StandardTokenizer by passing a version 
into the factory. Unfortunately, this required passing a map:

{code}
        return new StandardTokenizerFactory(ImmutableMap.of(
            AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM,
            Version.LUCENE_4_6_1.toString()
        )).create();
{code}

This then fails:

{noformat}
java.lang.UnsupportedOperationException
        at com.google.common.collect.ImmutableMap.remove(ImmutableMap.java:338)
        at 
org.apache.lucene.analysis.util.AbstractAnalysisFactory.get(AbstractAnalysisFactory.java:122)
        at 
org.apache.lucene.analysis.util.AbstractAnalysisFactory.<init>(AbstractAnalysisFactory.java:71)
        at 
org.apache.lucene.analysis.util.TokenizerFactory.<init>(TokenizerFactory.java:70)
        at 
org.apache.lucene.analysis.standard.StandardTokenizerFactory.<init>(StandardTokenizerFactory.java:42)
{noformat}

I suspect that someone put in a `remove` when it should have been a `get`... 
bit of a weird mistake to make, especially when you don't know whether the map 
will permit it.

I haven't verified whether the same occurs in later versions but getting 
updated to 5.2.1 will probably be the next thing on my list.




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

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

Reply via email to