fixed issue with URL stream handler
This commit is contained in:
@@ -3,7 +3,7 @@ publishMavenRepositoryUrl=https://mvn.woggioni.net/
|
||||
|
||||
lys-gradle-plugins.version = 2022.06
|
||||
|
||||
version.envelope=2022.06
|
||||
version.envelope=2022.08
|
||||
version.gradle=7.5
|
||||
version.lombok=1.18.22
|
||||
version.junitJupiter=5.7.2
|
||||
|
@@ -59,6 +59,7 @@ public class Launcher {
|
||||
@SneakyThrows
|
||||
public static void main(String[] args) {
|
||||
Enumeration<URL> it = Launcher.class.getClassLoader().getResources(Constants.SYSTEM_PROPERTIES_FILE);
|
||||
JarFile.registerUrlProtocolHandler();
|
||||
while (it.hasMoreElements()) {
|
||||
URL url = it.nextElement();
|
||||
Properties properties = new Properties();
|
||||
|
@@ -38,7 +38,7 @@ import java.util.regex.Pattern;
|
||||
* @since 1.0.0
|
||||
* @see JarFile#registerUrlProtocolHandler()
|
||||
*/
|
||||
public class Handler extends URLStreamHandler {
|
||||
public abstract class AbstractHandler extends URLStreamHandler {
|
||||
|
||||
// NOTE: in order to be found as a URL protocol handler, this class must be public,
|
||||
// must be named Handler and must be in a package ending '.jar'
|
||||
@@ -75,11 +75,11 @@ public class Handler extends URLStreamHandler {
|
||||
|
||||
private URLStreamHandler fallbackHandler;
|
||||
|
||||
public Handler() {
|
||||
public AbstractHandler() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public Handler(JarFile jarFile) {
|
||||
public AbstractHandler(JarFile jarFile) {
|
||||
this.jarFile = jarFile;
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package net.woggioni.envelope.loader;
|
||||
|
||||
import net.woggioni.envelope.loader.jar.Handler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilePermission;
|
||||
import java.io.IOException;
|
||||
@@ -60,7 +62,7 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
|
||||
|
||||
private static final String PROTOCOL_HANDLER = "java.protocol.handler.pkgs";
|
||||
|
||||
private static final String HANDLERS_PACKAGE = "net.woggioni.xclassloader.jar";
|
||||
private static final String HANDLERS_PACKAGE = "net.woggioni.envelope.loader";
|
||||
|
||||
private static final Bytes.AsciiBytes META_INF = new Bytes.AsciiBytes("META-INF/");
|
||||
|
||||
@@ -444,7 +446,7 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
|
||||
* {@link URLStreamHandler} will be located to deal with jar URLs.
|
||||
*/
|
||||
public static void registerUrlProtocolHandler() {
|
||||
Handler.captureJarContextUrl();
|
||||
AbstractHandler.captureJarContextUrl();
|
||||
String handlers = System.getProperty(PROTOCOL_HANDLER, "");
|
||||
System.setProperty(PROTOCOL_HANDLER,
|
||||
((handlers == null || handlers.isEmpty()) ? HANDLERS_PACKAGE : handlers + "|" + HANDLERS_PACKAGE));
|
||||
|
@@ -0,0 +1,15 @@
|
||||
package net.woggioni.envelope.loader.jar;
|
||||
|
||||
import net.woggioni.envelope.loader.AbstractHandler;
|
||||
import net.woggioni.envelope.loader.JarFile;
|
||||
|
||||
public class Handler extends AbstractHandler {
|
||||
|
||||
public Handler() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Handler(JarFile jarFile) {
|
||||
super(jarFile);
|
||||
}
|
||||
}
|
@@ -2,4 +2,5 @@ module net.woggioni.envelope.loader {
|
||||
requires java.logging;
|
||||
requires static lombok;
|
||||
exports net.woggioni.envelope.loader;
|
||||
exports net.woggioni.envelope.loader.jar;
|
||||
}
|
@@ -2,7 +2,7 @@ package net.woggioni.envelope.loader;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import net.woggioni.envelope.loader.JarFile;
|
||||
import net.woggioni.envelope.loader.Handler;
|
||||
import net.woggioni.envelope.loader.jar.Handler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
Reference in New Issue
Block a user