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

dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new a2bc4213a0 Protected against NPE in InstanceOperationsImpl.getServers 
(#5429)
a2bc4213a0 is described below

commit a2bc4213a010a00226a37c24f22718280820c1bb
Author: Dave Marion <dlmar...@apache.org>
AuthorDate: Tue Mar 25 15:31:56 2025 -0400

    Protected against NPE in InstanceOperationsImpl.getServers (#5429)
    
    ServiceLockData.getAddressString returns null if the ThriftService
    parameter is not found. The code was not protecting against
    this condition, and it started occurring with the changes in #5419
    where the Manager address is not advertised until the Manager
    is fully up, but the Manager lock is held.
---
 .../org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
index fb2c5878f8..2966f45432 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
@@ -564,7 +564,7 @@ public class InstanceOperationsImpl implements 
InstanceOperations {
           String location = null;
           if (sld.isPresent()) {
             location = 
sld.orElseThrow().getAddressString(ThriftService.MANAGER);
-            if (addressSelector.getPredicate().test(location)) {
+            if (location != null && 
addressSelector.getPredicate().test(location)) {
               HostAndPort hp = HostAndPort.fromString(location);
               results.add(new ServerId(type, 
Constants.DEFAULT_RESOURCE_GROUP_NAME, hp.getHost(),
                   hp.getPort()));
@@ -579,7 +579,7 @@ public class InstanceOperationsImpl implements 
InstanceOperations {
           String location = null;
           if (sld.isPresent()) {
             location = sld.orElseThrow().getAddressString(ThriftService.NONE);
-            if (addressSelector.getPredicate().test(location)) {
+            if (location != null && 
addressSelector.getPredicate().test(location)) {
               HostAndPort hp = HostAndPort.fromString(location);
               results.add(new ServerId(type, 
Constants.DEFAULT_RESOURCE_GROUP_NAME, hp.getHost(),
                   hp.getPort()));
@@ -594,7 +594,7 @@ public class InstanceOperationsImpl implements 
InstanceOperations {
           String location = null;
           if (sld.isPresent()) {
             location = sld.orElseThrow().getAddressString(ThriftService.GC);
-            if (addressSelector.getPredicate().test(location)) {
+            if (location != null && 
addressSelector.getPredicate().test(location)) {
               HostAndPort hp = HostAndPort.fromString(location);
               results.add(new ServerId(type, 
Constants.DEFAULT_RESOURCE_GROUP_NAME, hp.getHost(),
                   hp.getPort()));

Reply via email to