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

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

commit f61cbadd3ecb8461dc3001e6bd47b43382d68c19
Author: Hunter Lee <[email protected]>
AuthorDate: Tue Apr 2 18:09:03 2019 -0700

    TASK: Fix possible NPE in getWorkflowId()
    
    Old workflows may not have WorkflowID field set. This makes getWorkflowId() 
backward-compatible by falling back on its ZNRecord id instead.
    
    RB=1617517
    G=helix-reviewers
    A=jxue
    
    Signed-off-by: Hunter Lee <[email protected]>
---
 helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java 
b/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java
index 6136175..9f98f6b 100644
--- a/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java
+++ b/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java
@@ -154,7 +154,8 @@ public class WorkflowConfig extends ResourceConfig {
   }
 
   public String getWorkflowId() {
-    return getSimpleConfig(WorkflowConfigProperty.WorkflowID.name());
+    String workflowId = 
getSimpleConfig(WorkflowConfigProperty.WorkflowID.name());
+    return workflowId != null ? workflowId : getId();
   }
 
   public JobDag getJobDag() {

Reply via email to