Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-10886

Using V2Request.process(solrClient) method throws NPE if the API returns an error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 7.0
    • 7.0
    • SolrJ, v2 API
    • None

    Description

      I was trying to use the V2Request to invoke the Config API and ran into this bug. In my case, the command had name missing but it is a required attribute:

      String addListenerCommand = "{'add-listener' : {'event':'newSearcher', 'class':'" + TestSolrEventListener.class.getName() + "'}}";
          V2Request request = new V2Request.Builder("/c/warmingTestColl/config").withMethod(SolrRequest.METHOD.POST).withPayload(addListenerCommand).build();
          request.process(solrClient);
      

      The logs show that there was an exception:

      4409 INFO  (qtp480792233-31) [n:127.0.0.1:35920_solr c:warmingTestColl s:shard1 r:core_node1 x:warmingTestColl_shard1_replica_n1] o.a.s.h.SolrConfigHandler Failed to run commands. errors are {add-listener={event=newSearcher\, class=org.apache.solr.cloud.TestCloudSearcherWarming$TestSolrEventListener}\, errorMessages=['name' is a required field]}
      

      But SolrJ, returned an NPE:

      java.lang.NullPointerException
      	at __randomizedtesting.SeedInfo.seed([312F78548DE0B0CB:B97B478E231CDD33]:0)
      	at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:160)
      	at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:177)
      

      Attachments

        1. SOLR-10886.patch
          4 kB
          Cao Manh Dat

        Activity

          People

            caomanhdat Cao Manh Dat
            shalin Shalin Shekhar Mangar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: