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

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


The following commit(s) were added to refs/heads/2.1 by this push:
     new 0de01c3022 Fix NPE caused by ExternalCompactions page in monitor 
(#5107)
0de01c3022 is described below

commit 0de01c3022aece0299ed111588651a2e2d950157
Author: Dom G. <domgargu...@apache.org>
AuthorDate: Tue Nov 26 11:22:43 2024 -0500

    Fix NPE caused by ExternalCompactions page in monitor (#5107)
---
 .../src/main/java/org/apache/accumulo/monitor/Monitor.java       | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index 80dd69b8cd..67fc46015d 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@ -687,9 +687,10 @@ public class Monitor extends AbstractServer implements 
HighlyAvailableService {
     public final RunningCompactions runningCompactions;
     public final Map<String,TExternalCompaction> ecRunningMap;
 
-    private ExternalCompactionsSnapshot(Map<String,TExternalCompaction> 
ecRunningMap) {
-      this.ecRunningMap = Collections.unmodifiableMap(ecRunningMap);
-      this.runningCompactions = new RunningCompactions(ecRunningMap);
+    private 
ExternalCompactionsSnapshot(Optional<Map<String,TExternalCompaction>> 
ecRunningMapOpt) {
+      this.ecRunningMap =
+          
ecRunningMapOpt.map(Collections::unmodifiableMap).orElse(Collections.emptyMap());
+      this.runningCompactions = new RunningCompactions(this.ecRunningMap);
     }
   }
 
@@ -707,7 +708,7 @@ public class Monitor extends AbstractServer implements 
HighlyAvailableService {
       throw new IllegalStateException("Unable to get running compactions from 
" + ccHost, e);
     }
 
-    return new ExternalCompactionsSnapshot(running.getCompactions());
+    return new 
ExternalCompactionsSnapshot(Optional.ofNullable(running.getCompactions()));
   }
 
   public RunningCompactions getRunnningCompactions() {

Reply via email to