Skip to content

Commit 7cca644

Browse files
committed
Fix NPE caused by ExternalCompactions page in monitor
1 parent 767a68a commit 7cca644

File tree

1 file changed

+5
-4
lines changed
  • server/monitor/src/main/java/org/apache/accumulo/monitor

1 file changed

+5
-4
lines changed

server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,10 @@ private static class ExternalCompactionsSnapshot {
687687
public final RunningCompactions runningCompactions;
688688
public final Map<String,TExternalCompaction> ecRunningMap;
689689

690-
private ExternalCompactionsSnapshot(Map<String,TExternalCompaction> ecRunningMap) {
691-
this.ecRunningMap = Collections.unmodifiableMap(ecRunningMap);
692-
this.runningCompactions = new RunningCompactions(ecRunningMap);
690+
private ExternalCompactionsSnapshot(Optional<Map<String,TExternalCompaction>> ecRunningMapOpt) {
691+
this.ecRunningMap =
692+
ecRunningMapOpt.map(Collections::unmodifiableMap).orElse(Collections.emptyMap());
693+
this.runningCompactions = new RunningCompactions(this.ecRunningMap);
693694
}
694695
}
695696

@@ -707,7 +708,7 @@ private ExternalCompactionsSnapshot computeExternalCompactionsSnapshot() {
707708
throw new IllegalStateException("Unable to get running compactions from " + ccHost, e);
708709
}
709710

710-
return new ExternalCompactionsSnapshot(running.getCompactions());
711+
return new ExternalCompactionsSnapshot(Optional.ofNullable(running.getCompactions()));
711712
}
712713

713714
public RunningCompactions getRunnningCompactions() {

0 commit comments

Comments
 (0)