gtully commented on code in PR #4241:
URL: https://github.com/apache/activemq-artemis/pull/4241#discussion_r988908611
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java:
##########
@@ -538,7 +546,146 @@ public void parsePrefixedProperties(Properties
properties, String prefix) throws
public void populateWithProperties(Map<String, Object> beanProperties)
throws InvocationTargetException, IllegalAccessException {
CollectionAutoFillPropertiesUtil autoFillCollections = new
CollectionAutoFillPropertiesUtil();
- BeanUtilsBean beanUtils = new BeanUtilsBean(new ConvertUtilsBean(),
autoFillCollections);
+ BeanUtilsBean beanUtils = new BeanUtilsBean(new ConvertUtilsBean(),
autoFillCollections) {
+ // override to treat missing properties as errors, not skip as the
default impl does
+ @Override
+ public void setProperty(final Object bean, String name, final Object
value) throws InvocationTargetException, IllegalAccessException {
+ {
+ if (logger.isTraceEnabled()) {
+ final StringBuilder sb = new StringBuilder(" setProperty(");
+ sb.append(bean);
+ sb.append(", ");
+ sb.append(name);
+ sb.append(", ");
+ if (value == null) {
+ sb.append("<NULL>");
+ } else if (value instanceof String) {
+ sb.append((String) value);
+ } else if (value instanceof String[]) {
+ final String[] values = (String[]) value;
+ sb.append('[');
+ for (int i = 0; i < values.length; i++) {
+ if (i > 0) {
+ sb.append(',');
+ }
+ sb.append(values[i]);
+ }
+ sb.append(']');
+ } else {
+ sb.append(value.toString());
+ }
+ sb.append(')');
+ logger.trace(sb.toString());
+ }
+
+ // Resolve any nested expression to get the actual target bean
+ Object target = bean;
+ final Resolver resolver = getPropertyUtils().getResolver();
+ while (resolver.hasNested(name)) {
+ try {
+ target = getPropertyUtils().getProperty(target,
resolver.next(name));
+ if (target == null) {
+ throw new InvocationTargetException(null, "Resolved
nested property for:" + name + ", on: " + bean + " was null");
+ }
+ name = resolver.remove(name);
+ } catch (final NoSuchMethodException e) {
+ throw new InvocationTargetException(e, "No getter for
property:" + name + ", on: " + bean);
+ }
+ }
+ if (logger.isTraceEnabled()) {
+ logger.trace(" Target bean = " + target);
+ logger.trace(" Target name = " + name);
Review Comment:
I see there is logging on the brain, but fair... will tidy, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]