BitoAgent commented on code in PR #13786:
URL: https://github.com/apache/dubbo/pull/13786#discussion_r1538250556
##########
dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java:
##########
@@ -221,7 +221,7 @@
/**
* The url of the reference service
*/
- protected final transient List<URL> urls = new ArrayList<URL>();
+ protected final transient List<URL> urls = new ArrayList<>();
Review Comment:
**Code Structure Issue**: Diamond operator ("<>") should be used for
instantiation instead of specifying the type on both sides. This makes the code
cleaner and easier to read. <br> **Fix**: Use the diamond operator for
instantiation to improve code readability. <br> **Code Suggestion**:
```
- protected final transient List<URL> urls = new ArrayList<URL>();
+ protected final transient List<URL> urls = new ArrayList<>();
```
##########
dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java:
##########
@@ -252,7 +252,7 @@
}
if (CollectionUtils.isNotEmpty(this.registries)) {
this.registries.forEach(registryConfig -> {
- if (registryConfig.getScopeModel() != applicationModel) {
+ if (registryConfig != null && registryConfig.getScopeModel()
!= applicationModel) {
Review Comment:
**Code Structure Issue**: Null check added for registryConfig before
comparing its scope model. This prevents potential NullPointerException. <br>
**Fix**: Include a null check before accessing registryConfig properties to
ensure robustness against null references. <br> **Code Suggestion**:
```
- if (registryConfig.getScopeModel() != applicationModel) {
+ if (registryConfig != null &&
registryConfig.getScopeModel() != applicationModel) {
```
--
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]