brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [08/10] brooklyn-server git commit: fixes from PR review
Date Wed, 15 Feb 2017 11:56:02 GMT
fixes from PR review


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c8a462dd
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c8a462dd
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c8a462dd

Branch: refs/heads/master
Commit: c8a462dd5ff50d7e738eb7651482809e47f9ce9a
Parents: a1b5e3f
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Tue Feb 14 18:11:29 2017 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Tue Feb 14 18:11:29 2017 +0000

----------------------------------------------------------------------
 .../brooklyn/spi/dsl/DslDeferredFunctionCall.java     | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c8a462dd/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
index fc56a37..b8387b3 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
@@ -58,10 +58,18 @@ public class DslDeferredFunctionCall extends BrooklynDslDeferredSupplier<Object>
         return invokeOnDeferred(object, true);
     }
 
+    private static String toStringF(String fnName, Object args) {
+        return fnName + blankIfNull(args);
+    }
+    private static String blankIfNull(Object args) {
+        if (args==null) return "";
+        return args.toString();
+    }
+    
     @Override
     public Task<Object> newTask() {
         return Tasks.builder()
-                .displayName("Deferred function call " + object + "." + fnName + args + ")")
+                .displayName("Deferred function call " + object + "." + toStringF(fnName,
args))
                 .tag(BrooklynTaskTags.TRANSIENT_TASK_TAG)
                 .dynamic(false)
                 .body(new Callable<Object>() {
@@ -80,7 +88,7 @@ public class DslDeferredFunctionCall extends BrooklynDslDeferredSupplier<Object>
 
             if (instance == null) {
                 throw new IllegalArgumentException("Deferred function call not found: " +

-                        object + " evaluates to null (wanting to call " + fnName + args +
"))");
+                        object + " evaluates to null (wanting to call " + toStringF(fnName,
args) + ")");
             }
 
             return invokeOn(instance);
@@ -129,7 +137,7 @@ public class DslDeferredFunctionCall extends BrooklynDslDeferredSupplier<Object>
                     return Maybe.of(Reflections.invokeMethodFromArgs(instance, m, instanceArgs));
                 } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException
e) {
                     // If the method is there but not executable for whatever reason fail
with a fatal error, don't return an absent.
-                    throw Exceptions.propagate(new InvocationTargetException(e, "Error invoking
'"+fnName+instanceArgs+"' on '"+instance+"'"));
+                    throw Exceptions.propagateAnnotated("Error invoking '"+toStringF(fnName,
instanceArgs)+"' on '"+instance+"'", e);
                 }
             } else {
                 // could do deferred execution if an argument is a deferred supplier:


Mime
View raw message