You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2022/08/24 14:46:01 UTC

[brooklyn-server] branch master updated: fix falsy check not to evaluate if absent

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 c5cdf6ed50 fix falsy check not to evaluate if absent
c5cdf6ed50 is described below

commit c5cdf6ed50cf617acff6ec48c158d67c3a7fbd33
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Wed Aug 24 15:45:48 2022 +0100

    fix falsy check not to evaluate if absent
---
 .../java/org/apache/brooklyn/util/core/predicates/DslPredicates.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/brooklyn/util/core/predicates/DslPredicates.java b/core/src/main/java/org/apache/brooklyn/util/core/predicates/DslPredicates.java
index 369676a7a1..02dd1c62ae 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/predicates/DslPredicates.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/predicates/DslPredicates.java
@@ -323,7 +323,7 @@ public class DslPredicates {
                 } catch (Exception e) {
                     Exceptions.propagateIfFatal(e);
                     if (LOG.isTraceEnabled()) LOG.trace("Unable to evaluate jsonpath '"+jsonpathTidied+"' for '"+value+"' due to: "+e, e);
-                    return Maybe.absent("Cannot evaluate jsonpath");
+                    return Maybe.absent("No jsonpath matches");
                 }
 
                 // above will throw if jsonpath doesn't match anything
@@ -428,7 +428,7 @@ public class DslPredicates {
                     case ABSENT_OR_NULL: return result.isAbsentOrNull();
                     case ALWAYS: return true;
                     case NEVER: return false;
-                    case FALSY: return result.isAbsentOrNull() && !JavaGroovyEquivalents.groovyTruth(result.get());
+                    case FALSY: return result.isAbsent() || !JavaGroovyEquivalents.groovyTruth(result.get());
                     case TRUTHY: return result.isPresentAndNonNull() && JavaGroovyEquivalents.groovyTruth(result.get());
                     default: return false;
                 }