Prevent Tomcat URL "reflective access" warnings
Update the jar `Handler` class to support a non-reflective fallback mechanism when possible. The updated code attempts to capture a regular jar URL before our handler is installed. It can then use that URL as context when creating the a fallback URL. The JDK jar `Handler` will be copied from the context URL to the fallback URL. Without this commit, resolving new Tomcat URLs of the form `jar:war:file:...` would result in an ugly "Illegal reflective access" warning. Fixes gh-18631
This commit is contained in:
@@ -163,6 +163,7 @@ class HandlerTests {
|
||||
URLConnection jdkConnection = new URL(null, "jar:file:" + testJar.toURI().toURL() + "!/nested.jar!/",
|
||||
this.handler).openConnection();
|
||||
assertThat(jdkConnection).isNotInstanceOf(JarURLConnection.class);
|
||||
assertThat(jdkConnection.getClass().getName()).endsWith(".JarURLConnection");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user