zhaojinchao95 commented on code in PR #25809:
URL: https://github.com/apache/shardingsphere/pull/25809#discussion_r1200244235


##########
mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java:
##########
@@ -57,49 +67,54 @@ public final class JDBCRepositorySQLLoader {
      */
     @SneakyThrows({JAXBException.class, IOException.class, 
URISyntaxException.class})
     public static JDBCRepositorySQL load(final String type) {
-        File file = new 
File(JDBCRepositorySQLLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath());
-        return file.isFile() ? loadFromJar(file, type) : 
loadFromDirectory(type);
-    }
-    
-    private static JDBCRepositorySQL loadFromDirectory(final String type) 
throws URISyntaxException, IOException {
-        Enumeration<URL> urls = 
Thread.currentThread().getContextClassLoader().getResources(ROOT_DIRECTORY);
-        if (null == urls) {
+        Enumeration<URL> resources = 
Thread.currentThread().getContextClassLoader().getResources(ROOT_DIRECTORY);
+        if (null == resources) {
             return null;
         }
+        JDBCRepositorySQL jdbcRepositorySQL = null;
+        while (resources.hasMoreElements()) {
+            URL resource = resources.nextElement();
+            jdbcRepositorySQL = isJarURL(resource) ? loadFromJar(resource, 
type) : loadFromDirectory(resource, type);
+            if (null != jdbcRepositorySQL && 
Objects.equals(jdbcRepositorySQL.isDefault(), false)) {
+                break;
+            }
+        }
+        return jdbcRepositorySQL;

Review Comment:
   Please change `jdbcRepositorySQL`  to `result`.



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