ddanielr commented on code in PR #3915:
URL: https://github.com/apache/accumulo/pull/3915#discussion_r1391430545


##########
core/src/main/java/org/apache/accumulo/core/spi/compaction/DefaultCompactionPlanner.java:
##########
@@ -146,15 +172,25 @@ public String toString() {
       justification = "Field is written by Gson")
   @Override
   public void init(InitParameters params) {
-    ExecutorConfig[] execConfigs =
-        GSON.get().fromJson(params.getOptions().get("executors"), 
ExecutorConfig[].class);
-
     List<Executor> tmpExec = new ArrayList<>();
+    ExecutorConfig[] execConfigs = null;
+    QueueConfig[] queueConfigs = null;
+
+    try {
+      execConfigs =
+          GSON.get().fromJson(params.getOptions().get("executors"), 
ExecutorConfig[].class);
+    } catch (NullPointerException npe) {
+      // npe could result from executors not being set as properties.
+    } finally {
+      // Generated a zero-length array to avoid a npe thrown by forEach
+      if (execConfigs == null) {
+        execConfigs = new ExecutorConfig[0];
+      }
+    }

Review Comment:
   Had to account for some other blank/empty string conditions but I was able 
to rework the logic to avoid these try catch statements.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to