[
https://issues.apache.org/jira/browse/SOLR-7508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Scheffler updated SOLR-7508:
-----------------------------------
Description:
Following JUnit test to show what I mean:
{code}
ModifiableSolrParams params = new ModifiableSolrParams();
String[] paramValues = new String[] { "title:junit", "author:john" };
String paramName = "fq";
params.add(paramName, paramValues);
NamedList<Object> namedList = params.toNamedList();
assertEquals("parameter values are not equal", paramValues,
namedList.get(paramName));
Map<String, String[]> multiMap = SolrParams.toMultiMap(namedList);
assertEquals("Expected " + paramValues.length + " values", paramValues.length,
multiMap.get(paramName).length);
{code}
The first {{assertEquals()}} will run fine, while the last one triggers the
error. Suddenly the length of the array is "1" and it's value of {{fq}} is like
{{[Ljava.lang.String;@6f09c9c0}}. Looking into the code I see that the
toMultiMap() method does not even look for arrays.
was:
Following JUnit test to show what I mean:
{code}
ModifiableSolrParams params = new ModifiableSolrParams();
String[] paramValues = new String[] { "title:junit", "author:john" };
String paramName = "fq";
params.add(paramName, paramValues);
NamedList<Object> namedList = params.toNamedList();
assertEquals("parameter values do not equal", paramValues,
namedList.get(paramName));
Map<String, String[]> multiMap = SolrParams.toMultiMap(namedList);
assertEquals("Expected " + paramValues.length + " values", paramValues.length,
multiMap.get(paramName).length);
{code}
The first {{assertEquals()}} will run fine, while the last one triggers the
error. Suddenly the length of the array is "1" and it's value of {{fq}} is like
{{[Ljava.lang.String;@6f09c9c0}}. Looking into the code I see that the
toMultiMap() method does not even look for arrays.
> SolrParams.toMultiMap() does not handle arrays
> ----------------------------------------------
>
> Key: SOLR-7508
> URL: https://issues.apache.org/jira/browse/SOLR-7508
> Project: Solr
> Issue Type: Bug
> Components: SolrJ
> Affects Versions: 5.0, 5.1
> Reporter: Thomas Scheffler
> Labels: easyfix, easytest
>
> Following JUnit test to show what I mean:
> {code}
> ModifiableSolrParams params = new ModifiableSolrParams();
> String[] paramValues = new String[] { "title:junit", "author:john" };
> String paramName = "fq";
> params.add(paramName, paramValues);
> NamedList<Object> namedList = params.toNamedList();
> assertEquals("parameter values are not equal", paramValues,
> namedList.get(paramName));
> Map<String, String[]> multiMap = SolrParams.toMultiMap(namedList);
> assertEquals("Expected " + paramValues.length + " values",
> paramValues.length, multiMap.get(paramName).length);
> {code}
> The first {{assertEquals()}} will run fine, while the last one triggers the
> error. Suddenly the length of the array is "1" and it's value of {{fq}} is
> like {{[Ljava.lang.String;@6f09c9c0}}. Looking into the code I see that the
> toMultiMap() method does not even look for arrays.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]