You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2019/01/15 16:25:23 UTC
[lucene-solr] branch branch_7x updated: SOLR-13137: NPE when
/admin/zookeeper/status endpoint hit in standalone mode
This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch branch_7x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_7x by this push:
new 3f87dd9 SOLR-13137: NPE when /admin/zookeeper/status endpoint hit in standalone mode
3f87dd9 is described below
commit 3f87dd9e6e3d78c38d765a7dd934934550bb4d1a
Author: Jan Høydahl <ja...@apache.org>
AuthorDate: Tue Jan 15 16:17:10 2019 +0100
SOLR-13137: NPE when /admin/zookeeper/status endpoint hit in standalone mode
(cherry picked from commit b7f99fe55a6fb6e7b38828676750b3512d6899a1)
---
solr/CHANGES.txt | 2 ++
.../org/apache/solr/handler/admin/ZookeeperStatusHandler.java | 9 +++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c8d7a79..428256d 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -82,6 +82,8 @@ Bug Fixes
* SOLR-13053: NodeAddedTrigger and NodeLostTrigger do not reserve added/removed time populated by restoreState
(Cao Manh Dat)
+* SOLR-13137: NPE when /admin/zookeeper/status endpoint hit in standalone mode (janhoy)
+
Improvements
----------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java
index 8842437..1f3a504 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperStatusHandler.java
@@ -32,7 +32,6 @@ import java.util.Map;
import java.util.stream.Collectors;
import org.apache.solr.common.SolrException;
-import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.handler.RequestHandlerBase;
@@ -73,10 +72,12 @@ public final class ZookeeperStatusHandler extends RequestHandlerBase {
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
- final SolrParams params = req.getParams();
- Map<String, String> map = new HashMap<>(1);
NamedList values = rsp.getValues();
- values.add("zkStatus", getZkStatus(cores.getZkController().getZkServerAddress()));
+ if (cores.isZooKeeperAware()) {
+ values.add("zkStatus", getZkStatus(cores.getZkController().getZkServerAddress()));
+ } else {
+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "The Zookeeper status API is only available in Cloud mode");
+ }
}
/*