From f4f3426932cfdba6de978b329fb731067641af18 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Mon, 15 May 2023 10:37:01 +0200 Subject: [PATCH] Avoid exception message set to 'null' Signed-off-by: Maros Marsalek --- .../java/com/netflix/conductor/client/http/EventClient.java | 1 + .../netflix/conductor/core/execution/DeciderService.java | 6 +++++- .../netflix/conductor/sdk/testing/LocalServerRunner.java | 1 + .../conductor/test/integration/SimpleWorkflowSpec.groovy | 6 ++++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/client/src/main/java/com/netflix/conductor/client/http/EventClient.java b/client/src/main/java/com/netflix/conductor/client/http/EventClient.java index da494ae925..660c2b44a1 100644 --- a/client/src/main/java/com/netflix/conductor/client/http/EventClient.java +++ b/client/src/main/java/com/netflix/conductor/client/http/EventClient.java @@ -30,6 +30,7 @@ public class EventClient extends ClientBase { private static final GenericType> eventHandlerList = new GenericType>() {}; + /** Creates a default metadata client */ public EventClient() { this(new DefaultClientConfig(), new DefaultConductorClientConfiguration(), null); diff --git a/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java b/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java index 5ce4d289e5..c6bf486baa 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java @@ -545,7 +545,11 @@ Optional retry( break; } updateWorkflowOutput(workflow, task); - throw new TerminateWorkflowException(task.getReasonForIncompletion(), status, task); + final String errMsg = + String.format( + "Task %s failed with status: %s and reason: '%s'", + task.getTaskId(), status, task.getReasonForIncompletion()); + throw new TerminateWorkflowException(errMsg, status, task); } // retry... - but not immediately - put a delay... diff --git a/java-sdk/src/main/java/com/netflix/conductor/sdk/testing/LocalServerRunner.java b/java-sdk/src/main/java/com/netflix/conductor/sdk/testing/LocalServerRunner.java index f406fa0516..452336431d 100644 --- a/java-sdk/src/main/java/com/netflix/conductor/sdk/testing/LocalServerRunner.java +++ b/java-sdk/src/main/java/com/netflix/conductor/sdk/testing/LocalServerRunner.java @@ -65,6 +65,7 @@ public LocalServerRunner(int port, String conductorVersion) { public String getServerAPIUrl() { return this.serverURL + "api/"; } + /** * Starts the local server. Downloads the latest conductor build from the maven repo If you want * to start the server from a specific download location, set `repositoryURL` system property diff --git a/test-harness/src/test/groovy/com/netflix/conductor/test/integration/SimpleWorkflowSpec.groovy b/test-harness/src/test/groovy/com/netflix/conductor/test/integration/SimpleWorkflowSpec.groovy index 05c1c4c618..539a3d9d6c 100644 --- a/test-harness/src/test/groovy/com/netflix/conductor/test/integration/SimpleWorkflowSpec.groovy +++ b/test-harness/src/test/groovy/com/netflix/conductor/test/integration/SimpleWorkflowSpec.groovy @@ -210,10 +210,12 @@ class SimpleWorkflowSpec extends AbstractSpecification { and: "verify that the workflow is in a failed state" with(workflowExecutionService.getExecutionStatus(workflowInstanceId, true)) { status == Workflow.WorkflowStatus.FAILED - reasonForIncompletion == 'NON TRANSIENT ERROR OCCURRED: An integration point required to complete the task is down' + def t1 = getTaskByRefName('t1') + reasonForIncompletion == "Task ${t1.taskId} failed with status: FAILED and reason: " + + "'NON TRANSIENT ERROR OCCURRED: An integration point required to complete the task is down'" output['o1'] == 'p1 value' output['validationErrors'] == 'There was a terminal error' - getTaskByRefName('t1').retryCount == 0 + t1.retryCount == 0 failedReferenceTaskNames == ['t1'] as HashSet failedTaskNames == ['integration_task_1'] as HashSet }