linghengqian commented on code in PR #30139:
URL: https://github.com/apache/shardingsphere/pull/30139#discussion_r1492386046


##########
jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/url/type/ClassPathURLLoader.java:
##########
@@ -35,16 +36,12 @@ public final class ClassPathURLLoader implements 
ShardingSphereURLLoader {
     @Override
     @SneakyThrows(IOException.class)
     public byte[] getContent(final ShardingSphereURL url) {
-        try (InputStream inputStream = 
getResourceAsStreamFromClasspath(url.getConfigurationSubject())) {
-            return ConfigurationContentReader.read(inputStream, 
URLArgumentPlaceholderTypeFactory.valueOf(url.getParameters()));
-        }
+        return 
ConfigurationContentReader.read(getResourceFile(url.getConfigurationSubject()), 
URLArgumentPlaceholderTypeFactory.valueOf(url.getParameters()));
     }
     
-    private InputStream getResourceAsStreamFromClasspath(final String 
resource) {
-        InputStream result = 
Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
-        result = null == result ? 
Thread.currentThread().getContextClassLoader().getResourceAsStream("/" + 
resource) : result;
-        Preconditions.checkNotNull(result, "Can not find configuration file 
`%s`.", resource);
-        return result;
+    @SneakyThrows(URISyntaxException.class)
+    private File getResourceFile(final String configurationSubject) {
+        return new 
File(Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource(configurationSubject)).toURI().getPath());

Review Comment:
   - See #30145 .



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