You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by pr...@apache.org on 2021/12/28 05:06:48 UTC
[ranger] branch master updated: RANGER-3290 ArrayIndexOutOfBoundsException if solr is down
This is an automated email from the ASF dual-hosted git repository.
pradeep pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push:
new bbbc23c RANGER-3290 ArrayIndexOutOfBoundsException if solr is down
bbbc23c is described below
commit bbbc23c005432c715d741e6ea61a9aaddc569845
Author: Andras Salamon <an...@melda.info>
AuthorDate: Mon Dec 27 11:57:33 2021 +0100
RANGER-3290 ArrayIndexOutOfBoundsException if solr is down
Signed-off-by: pradeep <pr...@apache.org>
---
.../org/apache/ranger/server/tomcat/SolrCollectionBootstrapper.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/SolrCollectionBootstrapper.java b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/SolrCollectionBootstrapper.java
index 1596beb..fe4006f 100644
--- a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/SolrCollectionBootstrapper.java
+++ b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/SolrCollectionBootstrapper.java
@@ -36,6 +36,7 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.security.SecureClientLogin;
import org.apache.http.HttpEntity;
@@ -459,8 +460,11 @@ public class SolrCollectionBootstrapper extends Thread {
return zookeeperHosts;
}
- private String getBaseUrl() {
+ private String getBaseUrl() throws Exception {
Set<String> nodes = solrCloudClient.getClusterStateProvider().getLiveNodes();
+ if (CollectionUtils.isEmpty(nodes)) {
+ throw new Exception("No live SolrServers available");
+ }
String[] nodeArr = nodes.toArray(new String[0]);
// getting nodes URL as 'port_solr', so converting it to 'port/solr'
return nodeArr[0].replaceAll("_", "/");