Pace2Car commented on code in PR #27991:
URL: https://github.com/apache/shardingsphere/pull/27991#discussion_r1289494416


##########
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaDataReflection.java:
##########
@@ -36,19 +36,31 @@ public final class DataSourcePoolMetaDataReflection {
     
     /**
      * Get JDBC URL.
+     * Get it directly through the attribute first, and get it through the get 
method when it is empty

Review Comment:
   unnecessary comments.



##########
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaDataReflection.java:
##########
@@ -36,19 +36,31 @@ public final class DataSourcePoolMetaDataReflection {
     
     /**
      * Get JDBC URL.
+     * Get it directly through the attribute first, and get it through the get 
method when it is empty
      *
      * @return JDBC URL
      */
     public Optional<String> getJdbcUrl() {
-        return ReflectionUtils.getFieldValue(targetDataSource, 
dataSourcePoolFieldMetaData.getJdbcUrlFieldName());
+        Optional<String> jdbcUrl = 
ReflectionUtils.getFieldValue(targetDataSource, 
dataSourcePoolFieldMetaData.getJdbcUrlFieldName());
+        if (jdbcUrl.isPresent()) {
+            return jdbcUrl;
+        } else {
+            return ReflectionUtils.getFieldValueByGetMethod(targetDataSource, 
dataSourcePoolFieldMetaData.getJdbcUrlFieldName());
+        }
     }
     
     /**
      * Get JDBC connection properties.
-     * 
+     * Get it directly through the attribute first, and get it through the get 
method when it is empty

Review Comment:
   unnecessary comments.



-- 
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]

Reply via email to