uuuyuqi commented on code in PR #16231:
URL: https://github.com/apache/dubbo/pull/16231#discussion_r3144525337
##########
dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java:
##########
@@ -795,15 +795,19 @@ private T createExtension(String name, boolean wrap) {
}
if (CollectionUtils.isNotEmpty(wrapperClassesList)) {
- appliedWrapperClasses = new
ArrayList<>(wrapperClassesList.size());
+ if (logger.isDebugEnabled()) {
+ appliedWrapperClasses = new
ArrayList<>(wrapperClassesList.size());
+ }
for (Class<?> wrapperClass : wrapperClassesList) {
Wrapper wrapper =
wrapperClass.getAnnotation(Wrapper.class);
boolean match = (wrapper == null)
|| ((ArrayUtils.isEmpty(wrapper.matches())
||
ArrayUtils.contains(wrapper.matches(), name))
&&
!ArrayUtils.contains(wrapper.mismatches(), name));
if (match) {
- appliedWrapperClasses.add(wrapperClass);
+ if (logger.isDebugEnabled()) {
Review Comment:
Dynamically modifying the log level might cause an NPE error. For
performance optimization, consider adding a null check.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]