|
24 | 24 | import java.security.AccessController; |
25 | 25 | import java.security.PrivilegedExceptionAction; |
26 | 26 | import java.util.Enumeration; |
| 27 | +import java.util.jar.JarFile; |
27 | 28 |
|
28 | 29 | import org.springframework.boot.loader.jar.Handler; |
29 | | -import org.springframework.boot.loader.jar.JarFile; |
30 | 30 |
|
31 | 31 | /** |
32 | 32 | * {@link ClassLoader} used by the {@link Launcher}. |
@@ -131,8 +131,10 @@ public Object run() throws ClassNotFoundException { |
131 | 131 | String classEntryName = className.replace(".", "/") + ".class"; |
132 | 132 | for (URL url : getURLs()) { |
133 | 133 | try { |
134 | | - if (url.getContent() instanceof JarFile) { |
135 | | - JarFile jarFile = (JarFile) url.getContent(); |
| 134 | + URLConnection connection = url.openConnection(); |
| 135 | + if (connection instanceof JarURLConnection) { |
| 136 | + JarFile jarFile = ((JarURLConnection) connection) |
| 137 | + .getJarFile(); |
136 | 138 | if (jarFile.getEntry(classEntryName) != null |
137 | 139 | && jarFile.getEntry(packageEntryName) != null |
138 | 140 | && jarFile.getManifest() != null) { |
@@ -175,8 +177,8 @@ public void clearCache() { |
175 | 177 |
|
176 | 178 | private void clearCache(URLConnection connection) throws IOException { |
177 | 179 | Object jarFile = ((JarURLConnection) connection).getJarFile(); |
178 | | - if (jarFile instanceof JarFile) { |
179 | | - ((JarFile) jarFile).clearCache(); |
| 180 | + if (jarFile instanceof org.springframework.boot.loader.jar.JarFile) { |
| 181 | + ((org.springframework.boot.loader.jar.JarFile) jarFile).clearCache(); |
180 | 182 | } |
181 | 183 | } |
182 | 184 |
|
|
0 commit comments