Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
5.3, 5.4
-
None
Description
While debugging the SolrExampleStreamingTest.testUpdateField failures on trunk, I noticed that ConcurrentUpdateSolrClient always logs the following when the server throws a conflict error:
WARN (concurrentUpdateScheduler-2-thread-1-processing-http:////127.0.0.1:35848//solr//collection1) [ ] o.a.s.c.s.i.ConcurrentUpdateSolrClient Failed to parse error response from http://127.0.0.1:35848/solr/collection1 due to: org.apache.solr.common.SolrException: parsing error
The problem is the following code which uses the response.getEntity().getContentType().getValue() as the charset encoding which is wrong because content type has mime type as well as charset.
try { NamedList<Object> resp = client.parser.processResponse(response.getEntity().getContent(), response.getEntity().getContentType().getValue()); NamedList<Object> error = (NamedList<Object>) resp.get("error"); if (error != null) solrExc.setMetadata((NamedList<String>) error.get("metadata")); } catch (Exception exc) { // don't want to fail to report error if parsing the response fails log.warn("Failed to parse error response from " + client.getBaseURL() + " due to: " + exc); }