brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [07/15] incubator-brooklyn git commit: better warnings on plan parse failures
Date Tue, 15 Sep 2015 16:53:26 GMT
better warnings on plan parse failures


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

Branch: refs/heads/master
Commit: b9611658cce8d56be164692b55e615a31828b5a3
Parents: 2009a04
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Thu Sep 10 14:01:04 2015 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Thu Sep 10 14:02:02 2015 +0100

----------------------------------------------------------------------
 .../core/catalog/internal/CatalogInitialization.java        | 3 +++
 .../org/apache/brooklyn/core/plan/PlanToSpecFactory.java    | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9611658/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
index 041037f..525e903 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
@@ -208,6 +208,9 @@ public class CatalogInitialization implements ManagementContextInjectable
{
                     // once up and running the typical way to add items is via the REST API
                     hasRunFinalInitialization = true;
                 }
+            } catch (Throwable e) {
+                log.warn("Error populating catalog (rethrowing): "+e, e);
+                throw Exceptions.propagate(e);
             } finally {
                 if (!hasRunFinalInitialization) {
                     hasRunTransientOfficialInitialization = true;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9611658/core/src/main/java/org/apache/brooklyn/core/plan/PlanToSpecFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/plan/PlanToSpecFactory.java b/core/src/main/java/org/apache/brooklyn/core/plan/PlanToSpecFactory.java
index a2e6500..491a74e 100644
--- a/core/src/main/java/org/apache/brooklyn/core/plan/PlanToSpecFactory.java
+++ b/core/src/main/java/org/apache/brooklyn/core/plan/PlanToSpecFactory.java
@@ -95,11 +95,16 @@ public class PlanToSpecFactory {
         Collection<Exception> otherProblemsFromTransformers = new ArrayList<Exception>();
         for (PlanToSpecTransformer t: transformers) {
             try {
-                return Maybe.of(f.apply(t));
+                T result = f.apply(t);
+                if (result==null) {
+                    transformersWhoDontSupport.add(t.getShortDescription() + " (returned
null)");
+                    continue;
+                }
+                return Maybe.of(result);
             } catch (PlanNotRecognizedException e) {
                 transformersWhoDontSupport.add(t.getShortDescription() +
                     (Strings.isNonBlank(e.getMessage()) ? " ("+e.getMessage()+")" : ""));
-            } catch (Exception e) {
+            } catch (Throwable e) {
                 Exceptions.propagateIfFatal(e);
                 otherProblemsFromTransformers.add(new IllegalArgumentException("Transformer
for "+t.getShortDescription()+" gave an error creating this plan: "+
                     Exceptions.collapseText(e), e));


Mime
View raw message