gemmellr commented on code in PR #4979:
URL: https://github.com/apache/activemq-artemis/pull/4979#discussion_r1644220864


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java:
##########
@@ -3489,10 +3498,19 @@ private Object trackCollectionOrMap(String name, Object 
resolved, Object bean) {
 
       private Object findByNameProperty(String key, Collection collection) 
throws InvocationTargetException, IllegalAccessException, NoSuchMethodException 
{
          // locate on name property, may be a SimpleString
-         for (Object candidate : collection) {
-            Object candidateName = getProperty(candidate, "name");
-            if (candidateName != null && key.equals(candidateName.toString())) 
{
-               return candidate;
+         if (isClassProperty(key)) {

Review Comment:
   The comment on the line above this should either be adjusted, or move down 
toward the code it applied to originally.



##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java:
##########
@@ -958,6 +958,15 @@ public <T> T convert(Class<T> type, Object value) {
       updateApplyStatus(propsId, errors);
    }
 
+   private static boolean isClassProperty(String property) {
+      return property.endsWith(PROPERTY_CLASS_SUFFIX);
+   }
+
+   private static String extractPropertyClassName(String property) {
+      int propertyClassSuffixIndex = property.indexOf(PROPERTY_CLASS_SUFFIX);
+      return property.substring(0, propertyClassSuffixIndex);
+   }

Review Comment:
   These two are a bit inconsistent, in that the first one only checks for 
_endsWith_, but the second extracts only up to the _first_ instance found, 
which could be different. Would be better if they both operated on the end 
basis for consistency (also saves looking for the location index of a value you 
can already calculate).



-- 
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: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to