修复graalvm原生打包使用http工具被转为file协议问题

This commit is contained in:
Looly
2023-12-20 22:53:38 +08:00
parent 99ec3bbeb4
commit cd79e6e5f8
2 changed files with 9 additions and 0 deletions

View File

@@ -147,6 +147,14 @@ public class URLUtil extends URLEncodeUtil {
try {
return new URL(null, url, handler);
} catch (MalformedURLException e) {
// issue#I8PY3Y
if(e.getMessage().contains("Accessing an URL protocol that was not enabled")){
// Graalvm打包需要手动指定参数开启协议
// --enable-url-protocols=http
// --enable-url-protocols=https
throw new UtilException(e);
}
// 尝试文件路径
try {
return new File(url).toURI().toURL();