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

This commit is contained in:
Looly 2023-12-20 22:53:33 +08:00
parent 87df51effc
commit 1a9d4c2c9e

View File

@ -125,6 +125,14 @@ public class UrlUtil {
try {
return new URL(null, url, handler);
} catch (final 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 HutoolException(e);
}
// 尝试文件路径
try {
return new File(url).toURI().toURL();