This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
The following commit(s) were added to refs/heads/master by this push:
new 16ad21bd16 better error check+report for workflow
16ad21bd16 is described below
commit 16ad21bd1616e78ed0d76b959d086376cdfab534
Author: Alex Heneveld <[email protected]>
AuthorDate: Mon Feb 5 13:08:58 2024 +0000
better error check+report for workflow
---
.../java/org/apache/brooklyn/core/workflow/WorkflowErrorHandling.java | 4 ++--
.../core/workflow/steps/variables/SetVariableWorkflowStep.java | 4 ++--
.../core/workflow/steps/variables/TransformVariableWorkflowStep.java | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git
a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowErrorHandling.java
b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowErrorHandling.java
index c6f64edb68..8d5a21fac6 100644
---
a/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowErrorHandling.java
+++
b/core/src/main/java/org/apache/brooklyn/core/workflow/WorkflowErrorHandling.java
@@ -265,7 +265,7 @@ public class WorkflowErrorHandling implements
Callable<WorkflowErrorHandling.Wor
}
public static void logExceptionWhileHandlingException(Supplier<String>
src, Entity entity, Exception newError, Throwable oldError) {
- if (Exceptions.getCausalChain(newError).stream().anyMatch(e3 -> e3==
oldError)) {
+ if (Exceptions.getCausalChain(newError).stream().anyMatch(e3 ->
e3==oldError)) {
// is, or wraps, original error, don't need to log
// } else if (Exceptions.isCausedByInterruptInAnyThread(e)
&& Exceptions.isCausedByInterruptInAnyThread(e2)) {
@@ -274,7 +274,7 @@ public class WorkflowErrorHandling implements
Callable<WorkflowErrorHandling.Wor
// log.debug("Error where error handler was
interrupted, after main thread was also interrupted: " + e2);
// log.trace("Full trace of original error was: " + e,
e);
- } else if (newError instanceof WorkflowFailException) {
+ } else if (Exceptions.getCausalChain(newError).stream().anyMatch(e3 ->
e3 instanceof WorkflowFailException)) {
log.debug("Workflow fail " + src.get() + "; throwing failure
object -- "+Exceptions.collapseText(newError)+" -- and dropping original error:
"+Exceptions.collapseText(oldError));
log.trace("Full trace of original error was: " + oldError,
oldError);
} else {
diff --git
a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/SetVariableWorkflowStep.java
b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/SetVariableWorkflowStep.java
index 79b41185fc..e809e76431 100644
---
a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/SetVariableWorkflowStep.java
+++
b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/SetVariableWorkflowStep.java
@@ -239,8 +239,8 @@ public class SetVariableWorkflowStep extends
WorkflowStepDefinition {
} catch (Exception e) {
Exceptions.propagateIfFatal(e);
if (wordsByQuote==null || wordsByQuote.size()>1) {
- if (Exceptions.getCausalChain(e).stream().anyMatch(cause
-> cause instanceof ParseException)) {
- // try again with the whole thing as tokens, if it is
an interpolated string with spaces inside it
+ if (Exceptions.getCausalChain(e).stream().anyMatch(cause
-> cause instanceof ParseException || cause instanceof
IllegalArgumentException)) {
+ // try again with the whole thing as tokens, if it is
an interpolated string with spaces inside it or mismatched quotes
try {
return process(MutableList.of(input));
} catch (Exception e2) {
diff --git
a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/TransformVariableWorkflowStep.java
b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/TransformVariableWorkflowStep.java
index 656e067c5c..fc59c55edb 100644
---
a/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/TransformVariableWorkflowStep.java
+++
b/core/src/main/java/org/apache/brooklyn/core/workflow/steps/variables/TransformVariableWorkflowStep.java
@@ -140,7 +140,7 @@ public class TransformVariableWorkflowStep extends
WorkflowStepDefinition {
// otherwise normal, it does not match a variable name, so
treat it as the value
}
if (isDisallowedUndecoratedVariable)
- throw new IllegalArgumentException("Legacy transform
syntax `transform var_name | ...` disallowed (" + vv_auto + "); use
'${"+vv_auto+"'}' if you don't want to update it or insert the keyword
'variable' if you do");
+ throw new IllegalArgumentException("Legacy transform
syntax `transform var_name | ...` disallowed (" + vv_auto + "); use
'${"+vv_auto+"}' if you don't want to update it or insert the keyword
'variable' if you do");
}
if (isVariable) {