Github user aledsage commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/887#discussion_r39291116
--- Diff:
core/src/main/java/org/apache/brooklyn/core/plan/PlanToSpecFactory.java ---
@@ -95,13 +96,18 @@ public static PlanToSpecTransformer
forPlanType(ManagementContext mgmt, String p
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) {
--- End diff --
Out of interest, why catch `Throwable`? We immediately do a
`Exceptions.propagateIfFatal(e)` so if it was an `Error` then we'd rethrow
immediately (as though we hadn't caught). Are there other throwable types that
we're hitting?
(I'm fine with the change; just want to know what throwables we should
expect to encounter).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---