[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-04-02 Thread Simon Endele (JIRA)

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

Simon Endele commented on SOLR-6709:


Thank you guys very much for fixing/reviewing and happy Easter!

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
>Assignee: Varun Thacker
> Fix For: Trunk, 5.2
>
> Attachments: SOLR-6709.patch, SOLR-6709.patch, SOLR-6709.patch, 
> test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-04-01 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on SOLR-6709:
---

Commit 1670579 from [~varunthacker] in branch 'dev/branches/branch_5x'
[ https://svn.apache.org/r1670579 ]

SOLR-6709: Fix QueryResponse to deal with the expanded section when using the 
XMLResponseParser (merged from trunk r1670569)

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
>Assignee: Varun Thacker
> Fix For: Trunk, 5.1
>
> Attachments: SOLR-6709.patch, SOLR-6709.patch, SOLR-6709.patch, 
> test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-04-01 Thread Varun Thacker (JIRA)

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

Varun Thacker commented on SOLR-6709:
-

Forgot to append the Jira number. Here is the revision where it was committed 
to trunk - https://svn.apache.org/viewvc?view=revision&revision=1670569 

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
>Assignee: Varun Thacker
> Fix For: Trunk, 5.1
>
> Attachments: SOLR-6709.patch, SOLR-6709.patch, SOLR-6709.patch, 
> test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-03-31 Thread Joel Bernstein (JIRA)

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

Joel Bernstein commented on SOLR-6709:
--

Looking at the patch, I don't see any issues. As long as the tests are passing 
I think we are fine.

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
>Assignee: Varun Thacker
> Fix For: Trunk, 5.1
>
> Attachments: SOLR-6709.patch, SOLR-6709.patch, SOLR-6709.patch, 
> test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-03-30 Thread Joel Bernstein (JIRA)

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

Joel Bernstein commented on SOLR-6709:
--

Just reviewed the test case and all the groups are accessed directly by name, 
this simulates access into a map. The order of the documents within the groups 
matter in the test case. But the order of the groups themselves does not.

The only thing I worry about is that someone might imply that order matters if 
we use an ordered map, but we could document this more closely.

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
>Assignee: Varun Thacker
> Fix For: Trunk, 5.1
>
> Attachments: SOLR-6709.patch, SOLR-6709.patch, test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-03-30 Thread Varun Thacker (JIRA)

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

Varun Thacker commented on SOLR-6709:
-

Thanks Joel for clarifying that. 

I'll run the tests and commit it shortly then.

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
>Assignee: Varun Thacker
> Fix For: Trunk, 5.1
>
> Attachments: SOLR-6709.patch, SOLR-6709.patch, test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-03-30 Thread Joel Bernstein (JIRA)

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

Joel Bernstein commented on SOLR-6709:
--

Hi Varun,

There was no contract on the ordering of group keys. The groups are meant to be 
read into a Map and then accessed by key.

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
>Assignee: Varun Thacker
> Fix For: Trunk, 5.1
>
> Attachments: SOLR-6709.patch, SOLR-6709.patch, test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-03-30 Thread Varun Thacker (JIRA)

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

Varun Thacker commented on SOLR-6709:
-

Hi Joel,

I would really appreciate a review on the patch. Not sure what the contract is 
on the ordering of group keys.

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
>Assignee: Varun Thacker
> Fix For: Trunk, 5.1
>
> Attachments: SOLR-6709.patch, SOLR-6709.patch, test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-03-25 Thread Varun Thacker (JIRA)

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

Varun Thacker commented on SOLR-6709:
-

The patch I had uploaded was failing with the expand components distrib tests. 
I realized that it was because the group keys that were being put into the 
HashMap the ordering when retrieving it was the same. Just changing 
{{Map outMap = new HashMap<>();}} to  {{Map 
outMap = new LinkedHashMap<>();}} will cause the test to fail.

I'll work on a new patch

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
> Attachments: SOLR-6709.patch, test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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



[jira] [Commented] (SOLR-6709) ClassCastException in QueryResponse after applying XMLResponseParser on a response containing an "expanded" section

2015-03-23 Thread Joel Bernstein (JIRA)

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

Joel Bernstein commented on SOLR-6709:
--

I should have a chance to take a look at this this week.

> ClassCastException in QueryResponse after applying XMLResponseParser on a 
> response containing an "expanded" section
> ---
>
> Key: SOLR-6709
> URL: https://issues.apache.org/jira/browse/SOLR-6709
> Project: Solr
>  Issue Type: Bug
>  Components: SolrJ
>Reporter: Simon Endele
> Attachments: SOLR-6709.patch, test-response.xml
>
>
> Shouldn't the following code work on the attached input file?
> It matches the structure of a Solr response with wt=xml.
> {code}import java.io.InputStream;
> import org.apache.solr.client.solrj.ResponseParser;
> import org.apache.solr.client.solrj.impl.XMLResponseParser;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.util.NamedList;
> import org.junit.Test;
> public class ParseXmlExpandedTest {
>   @Test
>   public void test() {
>   ResponseParser responseParser = new XMLResponseParser();
>   InputStream inStream = getClass()
>   .getResourceAsStream("test-response.xml");
>   NamedList response = responseParser
>   .processResponse(inStream, "UTF-8");
>   QueryResponse queryResponse = new QueryResponse(response, null);
>   }
> }{code}
> Unexpectedly (for me), it throws a
> java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap 
> cannot be cast to java.util.Map
> at 
> org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:126)
> Am I missing something, is XMLResponseParser deprecated or something?
> We use a setup like this to "mock" a QueryResponse for unit tests in our 
> service that post-processes the Solr response.
> Obviously, it works with the javabin format which SolrJ uses internally.
> But that is no appropriate format for unit tests, where the response should 
> be human readable.
> I think there's some conversion missing in QueryResponse or XMLResponseParser.
> Note: The null value supplied as SolrServer argument to the constructor of 
> QueryResponse shouldn't have an effect as the error occurs before the 
> parameter is even used.



--
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