brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [2/6] incubator-brooklyn git commit: better logging when can't instantiate on rebind
Date Mon, 16 Mar 2015 15:51:02 GMT
better logging when can't instantiate on rebind


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

Branch: refs/heads/master
Commit: b955f7f9a49bd1d8306bd68886f7ff26f662e032
Parents: b578f12
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Fri Mar 13 09:11:40 2015 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Fri Mar 13 09:13:00 2015 +0000

----------------------------------------------------------------------
 .../java/brooklyn/entity/rebind/RebindIteration.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b955f7f9/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java b/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java
index de956ae..75f36f8 100644
--- a/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java
+++ b/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java
@@ -21,6 +21,7 @@ package brooklyn.entity.rebind;
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -1042,7 +1043,17 @@ public abstract class RebindIteration {
                     throw Exceptions.propagate(e);
                 }
             }
-            throw new IllegalStateException("Cannot instantiate instance of type "+clazz+";
expected constructor signature not found");
+            StringBuilder args = new StringBuilder();
+            if (possibleArgs.length<1) args.append("no possible argument sets supplied;
error");
+            else if (possibleArgs.length<2) args.append("args are "+Arrays.asList(possibleArgs[0]));
+            else {
+                args.append("args are "+Arrays.asList(possibleArgs[0]));
+                for (int i=1; i<possibleArgs.length; i++) {
+                    args.append(" or ");
+                    args.append(Arrays.asList(possibleArgs[i]));
+                }
+            }
+            throw new IllegalStateException("Cannot instantiate instance of type "+clazz+";
expected constructor signature not found ("+args+")");
         }
     }
 


Mime
View raw message