This is an automated email from the ASF dual-hosted git repository.

wuweijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 1600cfb  fix file not found in windows os: config path with blank 
character re… (#13834)
1600cfb is described below

commit 1600cfbbbfb9405912fea7435074b8970e626f9c
Author: iMinusMinus <[email protected]>
AuthorDate: Mon Dec 6 14:09:22 2021 +0800

    fix file not found in windows os: config path with blank character re… 
(#13834)
    
    * fix file not found in windows os: config path with blank character 
replaced by '%20' in URL
    
    * using @SneakyThrows(URISyntaxException.class)
---
 .../shardingsphere/proxy/config/ProxyConfigurationLoader.java      | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoader.java
 
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoader.java
index afb7332..6be086f 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoader.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/ProxyConfigurationLoader.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.config;
 import com.google.common.base.Preconditions;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
+import lombok.SneakyThrows;
 import 
org.apache.shardingsphere.authority.yaml.config.YamlAuthorityRuleConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
 import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
@@ -28,6 +29,7 @@ import 
org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Collection;
 import java.util.HashSet;
@@ -61,10 +63,11 @@ public final class ProxyConfigurationLoader {
         return new YamlProxyConfiguration(serverConfig, 
ruleConfigs.stream().collect(Collectors.toMap(
                 YamlProxyRuleConfiguration::getSchemaName, each -> each, 
(oldValue, currentValue) -> oldValue, LinkedHashMap::new)));
     }
-    
+
+    @SneakyThrows(URISyntaxException.class)
     private static File getResourceFile(final String path) {
         URL url = ProxyConfigurationLoader.class.getResource(path);
-        return null == url ? new File(path) : new File(url.getFile());
+        return null == url ? new File(path) : new File(url.toURI().getPath());
     }
     
     private static YamlProxyServerConfiguration loadServerConfiguration(final 
File yamlFile) throws IOException {

Reply via email to