[ 
https://issues.apache.org/jira/browse/ARTEMIS-4025?focusedWorklogId=814333&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-814333
 ]

ASF GitHub Bot logged work on ARTEMIS-4025:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Oct/22 11:20
            Start Date: 06/Oct/22 11:20
    Worklog Time Spent: 10m 
      Work Description: 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.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 814333)
    Time Spent: 0.5h  (was: 20m)

> properties config -  provide error status for invalid properties
> ----------------------------------------------------------------
>
>                 Key: ARTEMIS-4025
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4025
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.26.0
>            Reporter: Gary Tully
>            Assignee: Gary Tully
>            Priority: Major
>             Fix For: 2.27.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> following up on the availability of a [status json|ARTEMIS-4007] - trap any 
> errors from bean util property failure to apply, for any in invalid property. 
> Currently all failures to find setters are silently ignored.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to