You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/08/17 03:49:14 UTC

[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #11853: fix npe when execute show readwrite_splitting rules

strongduanmu commented on a change in pull request #11853:
URL: https://github.com/apache/shardingsphere/pull/11853#discussion_r690012749



##########
File path: shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ReadwriteSplittingRuleQueryResultSet.java
##########
@@ -64,9 +64,9 @@ public boolean next() {
     @Override
     public Collection<Object> getRowData() {
         ReadwriteSplittingDataSourceRuleConfiguration ruleConfig = data.next();
+        ShardingSphereAlgorithmConfiguration configuration = loadBalancers.get(ruleConfig.getLoadBalancerName());
         return Arrays.asList(ruleConfig.getName(), ruleConfig.getAutoAwareDataSourceName(), ruleConfig.getWriteDataSourceName(), Joiner.on(",").join(ruleConfig.getReadDataSourceNames()),
-                null == loadBalancers.get(ruleConfig.getLoadBalancerName()) ? null : loadBalancers.get(ruleConfig.getLoadBalancerName()).getType(),
-                PropertiesConverter.convert(loadBalancers.get(ruleConfig.getLoadBalancerName()).getProps()));
+                null == configuration ? null : configuration.getType(), null == configuration ? null : PropertiesConverter.convert(configuration.getProps()));

Review comment:
       > more than 1 conditional operator in a clause is not a good practice .
   
   @taojintianxia Thank you for your suggestion.




-- 
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-unsubscribe@shardingsphere.apache.org

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