JarURLConnection.connect在URL为“0”时引发java.io.FileNotFoundException+&引用;

JarURLConnection.connect在URL为“0”时引发java.io.FileNotFoundException+&引用;,java,web-services,spring-boot,Java,Web Services,Spring Boot,JarURLConnection.connect当JAR文件包含+字符时抛出FileNotFoundException JAR入口启动INF/classes/在/Users/pp/git/Repo/build/libs/Repo-1.1.0+1.jar中找不到sam.wsdl 服务存储库: import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.ws.Service; import org.sp

JarURLConnection.connect
当JAR文件包含
+
字符时抛出
FileNotFoundException

JAR入口启动INF/classes/在/Users/pp/git/Repo/build/libs/Repo-1.1.0+1.jar中找不到sam.wsdl

服务存储库:

import java.io.IOException;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import org.springframework.core.io.ClassPathResource;

public class SampleService extends Service {

    public SampleService() throws IOException {
        super(new ClassPathResource("sam.wsdl", SampleService.class.getClassLoader()).getURL(), new QName("qname", "serv"));
    }
}
新类路径资源(“sam.wsdl”,SampleService.class.getClassLoader()).getURL()解析为URL时,此代码工作正常

jar:file:/Users/pp/git/Repo/build/libs/Repo-1.1.0.jar/BOOT-INF/classes/sam.wsdl

但当我有jar包含
+
抛出FNF异常时

jar:file:/Users/pp/git/Repo/build/libs/Repo-1.1.0+1.jar/BOOT-INF/classes/sam.wsdl


URL中的
+
字符实际上是编码的空格(ASCII SP/0x20)字符

如果希望URL与文件名中的
+
匹配,则需要对
+
字符进行百分比转义;e、 g

jar:file:/Users/pp/git/Repo/build/libs/repo-1.1.0%2B1.jar!/BOOT-INF/classes!/sam.wsdl