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

Bill Au commented on SOLR-335:
------------------------------

Since I am returning a null NamedList in SolrPingResponse, I have also put some 
checks into SolrResponseBase to guide against NPE:

--- 
client/java/solrj/src/org/apache/solr/client/solrj/response/SolrResponseBase.java
   (revision 574346)
+++ 
client/java/solrj/src/org/apache/solr/client/solrj/response/SolrResponseBase.java
   (working copy)
@@ -63,11 +63,23 @@
   
   // these two methods are based on the logic in 
SolrCore.setResponseHeaderValues(...)
   public int getStatus() {
-    return (Integer) getResponseHeader().get("status");
+    NamedList header = getResponseHeader();
+    if (header != null) {
+        return (Integer) header.get("status");
+    }
+    else {
+        return 0;
+    }
   }
   
   public int getQTime() {
-    return (Integer) getResponseHeader().get("QTime");
+    NamedList header = getResponseHeader();
+    if (header != null) {
+        return (Integer) header.get("QTime");
+    }
+    else {
+        return 0;
+    }
   }
 
   public String getRequestUrl() {


> solrj and ping / PingRequestHandler
> -----------------------------------
>
>                 Key: SOLR-335
>                 URL: https://issues.apache.org/jira/browse/SOLR-335
>             Project: Solr
>          Issue Type: Bug
>          Components: clients - java
>            Reporter: Ryan McKinley
>            Priority: Minor
>         Attachments: solr-335-workaround.patch
>
>
> Solrj needs to talk to a PingRequestHandler
> see: 
> http://www.nabble.com/-Solrj--Documentation---SolrServer-Ping-tf4246988.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to