You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Trejkaz (JIRA)" <ji...@apache.org> on 2015/07/03 07:55:04 UTC
[jira] [Updated] (LUCENE-6655) All analysis factory constructors
fail if the passed in map is immutable
[ https://issues.apache.org/jira/browse/LUCENE-6655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trejkaz updated LUCENE-6655:
----------------------------
Summary: All analysis factory constructors fail if the passed in map is immutable (was: StandardTokenizerFactory constructor fails if the passed in map is immutable)
There are ways to track that which don't require mutating a map that doesn't belong to you.
If all the analysis factories do that by mutating *my* map, then they're all broken. I'll update the summary accordingly.
> All analysis factory constructors fail 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org