Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/477#discussion_r92826512
--- Diff:
utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/TypeCoercerExtensible.java
---
@@ -209,12 +226,19 @@ public static TypeCoercerExtensible newEmpty() {
try {
return Maybe.of((T) m.invoke(null, value));
} catch (Exception e) {
- Maybe.absent(new ClassCoercionException("Cannot
coerce type "+value.getClass()+" to "+targetType.getCanonicalName()+"
("+value+"): "+m.getName()+" adapting failed, "+e));
+ exceptions.add(new ClassCoercionException("Cannot
coerce type "+value.getClass()+" to "+targetType.getCanonicalName()+"
("+value+"): "+m.getName()+" adapting failed", e));
}
}
}
}
- return null;
+ if (exceptions.isEmpty()) {
+ return null;
--- End diff --
Worth adding a comment somewhere on the notation (caller):
* null - no errors, continue with fallbacks (i.e. not found)
* absent - had some kind of exception, continue with fallbacks
* present - coercion successful, return value
---
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.
---