yao-wenbin commented on code in PR #7217:
URL: https://github.com/apache/rocketmq/pull/7217#discussion_r1301067843
##########
common/src/main/java/org/apache/rocketmq/common/MixAll.java:
##########
@@ -518,4 +520,25 @@ public static boolean
isSysConsumerGroupForNoColdReadLimit(String consumerGroup)
}
return false;
}
+
+ public static Set<String> invalidProperties(Properties properties,
Object... objects) {
+ if (objects == null || objects.length == 0) {
+ return null;
+ }
+ Set<String> propertyNames = properties.stringPropertyNames();
+
+ Set<String> fieldNames = new HashSet<>();
+ for (Object obj : objects) {
+ Method[] methods = obj.getClass().getMethods();
+ for (Method method : methods) {
+ String mn = method.getName();
+ if (mn.startsWith("get")) {
+ // get getter's field name and to camel name.
+ fieldNames.add(mn.substring(3, 4).toLowerCase() +
mn.substring(4));
+ }
+ }
+ }
+
+ return Sets.difference(propertyNames, fieldNames);
Review Comment:
I'm a little confused. The difference method only return a set of property
in property name set (which is user configure) but not in field names set
(which is RocketMQ Configuration Item). So I think it will correctly record the
invalid property name set in user's configuration file.
I write some test case in ``MixAllTest.java``, It would be better explain
that when logging will be missed if you could give me some clearly test case.~
--
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]