You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2021/09/08 21:05:11 UTC

[helix] branch master updated: Add input validation for getJobContext (#1864)

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

jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new b8ed768  Add input validation for getJobContext (#1864)
b8ed768 is described below

commit b8ed7685b5fc0efb162fe8c97cd56f995718d5af
Author: xyuanlu <xy...@gmail.com>
AuthorDate: Wed Sep 8 14:05:03 2021 -0700

    Add input validation for getJobContext (#1864)
    
    * add validation for getJobContext
---
 helix-core/src/main/java/org/apache/helix/task/TaskUtil.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java b/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
index e2de939..fc9b3d4 100644
--- a/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
+++ b/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
@@ -20,6 +20,7 @@ package org.apache.helix.task;
  */
 
 import java.io.IOException;
+import java.security.InvalidParameterException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -201,6 +202,9 @@ public class TaskUtil {
    */
   protected static JobContext getJobContext(HelixPropertyStore<ZNRecord> propertyStore,
       String jobResource) {
+    if (jobResource == null) {
+      throw new InvalidParameterException("Null job name is now allowed");
+    }
     ZNRecord r = propertyStore.get(
         Joiner.on("/").join(TaskConstants.REBALANCER_CONTEXT_ROOT, jobResource, CONTEXT_NODE), null,
         AccessOption.PERSISTENT);