You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ja...@apache.org on 2022/11/10 18:26:36 UTC

[solr] branch branch_9x updated: SOLR-16152 Print helpful error instead of NPE when using bin/solr package in standalone (#1150)

This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new a341aa0df16 SOLR-16152 Print helpful error instead of NPE when using bin/solr package in standalone (#1150)
a341aa0df16 is described below

commit a341aa0df160e334cc40a3d09e1a0fb79058171b
Author: Jan Høydahl <ja...@users.noreply.github.com>
AuthorDate: Thu Nov 10 19:24:42 2022 +0100

    SOLR-16152 Print helpful error instead of NPE when using bin/solr package in standalone (#1150)
---
 solr/core/src/java/org/apache/solr/util/PackageTool.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/solr/core/src/java/org/apache/solr/util/PackageTool.java b/solr/core/src/java/org/apache/solr/util/PackageTool.java
index c045ffb5cd4..9605af748d3 100644
--- a/solr/core/src/java/org/apache/solr/util/PackageTool.java
+++ b/solr/core/src/java/org/apache/solr/util/PackageTool.java
@@ -77,6 +77,9 @@ public class PackageTool extends SolrCLI.ToolBase {
       solrBaseUrl = solrUrl.replaceAll("\\/solr$", ""); // strip out ending "/solr"
       log.info("Solr url:{}, solr base url: {}", solrUrl, solrBaseUrl);
       String zkHost = getZkHost(cli);
+      if (zkHost == null) {
+        throw new SolrException(ErrorCode.INVALID_STATE, "Package manager runs only in SolrCloud");
+      }
 
       log.info("ZK: {}", zkHost);
       String cmd = cli.getArgList().size() == 0 ? "help" : cli.getArgs()[0];