Solr
  1. Solr
  2. SOLR-8366

ConcurrentUpdateSolrClient attempts to use response's content type as charset encoding for parsing exceptions

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3, 5.4
    • Fix Version/s: 5.5, 6.0
    • Component/s: clients - java
    • Labels:
      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);
                  }
      
      1. SOLR-8336.patch
        2 kB
        Shalin Shekhar Mangar

        Activity

        Hide
        Shalin Shekhar Mangar added a comment -

        Trivial fix attached.

        Show
        Shalin Shekhar Mangar added a comment - Trivial fix attached.
        Hide
        ASF subversion and git services added a comment -

        Commit 1717978 from shalin@apache.org in branch 'dev/trunk'
        [ https://svn.apache.org/r1717978 ]

        SOLR-8366: ConcurrentUpdateSolrClient attempts to use response's content type as charset encoding for parsing exception

        Show
        ASF subversion and git services added a comment - Commit 1717978 from shalin@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1717978 ] SOLR-8366 : ConcurrentUpdateSolrClient attempts to use response's content type as charset encoding for parsing exception
        Hide
        ASF subversion and git services added a comment -

        Commit 1717982 from shalin@apache.org in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1717982 ]

        SOLR-8366: ConcurrentUpdateSolrClient attempts to use response's content type as charset encoding for parsing exception

        Show
        ASF subversion and git services added a comment - Commit 1717982 from shalin@apache.org in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1717982 ] SOLR-8366 : ConcurrentUpdateSolrClient attempts to use response's content type as charset encoding for parsing exception

          People

          • Assignee:
            Shalin Shekhar Mangar
            Reporter:
            Shalin Shekhar Mangar
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development