Copilot commented on code in PR #7512:
URL: https://github.com/apache/incubator-seata/pull/7512#discussion_r2194182840


##########
server/src/main/java/org/apache/seata/server/instance/AbstractSeataInstanceStrategy.java:
##########
@@ -64,7 +64,8 @@ public void postConstruct() {
 
     @Override
     public void init() {
-        if (!StringUtils.equals(registryProperties.getType(), NAMING_SERVER)) {
+        String types = registryProperties.getType();
+        if (types == null || 
!Arrays.asList(types.split(",")).contains(NAMING_SERVER)) {

Review Comment:
   Splitting on commas without trimming may include whitespace in elements 
(e.g., `"naming-server ,consul"`), causing the check to fail. Consider using 
`split("\\s*,\\s*")` or trimming each element before matching.



##########
server/src/main/java/org/apache/seata/server/instance/AbstractSeataInstanceStrategy.java:
##########
@@ -64,7 +64,8 @@ public void postConstruct() {
 
     @Override
     public void init() {
-        if (!StringUtils.equals(registryProperties.getType(), NAMING_SERVER)) {
+        String types = registryProperties.getType();
+        if (types == null || 
!Arrays.asList(types.split(",")).contains(NAMING_SERVER)) {

Review Comment:
   [nitpick] Consider renaming the variable `types` to something more 
descriptive like `registryTypesString` or `typeListStr` for clarity.
   ```suggestion
           String registryTypesString = registryProperties.getType();
           if (registryTypesString == null || 
!Arrays.asList(registryTypesString.split(",")).contains(NAMING_SERVER)) {
   ```



-- 
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: notifications-unsubscr...@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to