|
36 | 36 | import java.util.zip.ZipEntry; |
37 | 37 | import java.security.CodeSigner; |
38 | 38 | import java.security.cert.Certificate; |
39 | | -import java.security.AccessController; |
40 | | -import java.security.PrivilegedExceptionAction; |
41 | | -import java.security.PrivilegedActionException; |
42 | 39 | import sun.net.www.ParseUtil; |
43 | 40 |
|
44 | 41 | /* URL jar file is a common JarFile subtype used for JarURLConnection */ |
@@ -159,39 +156,26 @@ private synchronized boolean isSuperMan() throws IOException { |
159 | 156 | * Given a URL, retrieves a JAR file, caches it to disk, and creates a |
160 | 157 | * cached JAR file object. |
161 | 158 | */ |
162 | | - @SuppressWarnings("removal") |
163 | 159 | private static JarFile retrieve(final URL url, final URLJarFileCloseController closeController) throws IOException { |
164 | | - JarFile result = null; |
165 | 160 | Runtime.Version version = "runtime".equals(url.getRef()) |
166 | 161 | ? JarFile.runtimeVersion() |
167 | 162 | : JarFile.baseVersion(); |
168 | | - |
169 | | - /* get the stream before asserting privileges */ |
170 | 163 | try (final InputStream in = url.openConnection().getInputStream()) { |
171 | | - result = AccessController.doPrivileged( |
172 | | - new PrivilegedExceptionAction<>() { |
173 | | - public JarFile run() throws IOException { |
174 | | - Path tmpFile = Files.createTempFile("jar_cache", null); |
175 | | - try { |
176 | | - Files.copy(in, tmpFile, StandardCopyOption.REPLACE_EXISTING); |
177 | | - JarFile jarFile = new URLJarFile(tmpFile.toFile(), closeController, version); |
178 | | - tmpFile.toFile().deleteOnExit(); |
179 | | - return jarFile; |
180 | | - } catch (Throwable thr) { |
181 | | - try { |
182 | | - Files.delete(tmpFile); |
183 | | - } catch (IOException ioe) { |
184 | | - thr.addSuppressed(ioe); |
185 | | - } |
186 | | - throw thr; |
187 | | - } |
188 | | - } |
189 | | - }); |
190 | | - } catch (PrivilegedActionException pae) { |
191 | | - throw (IOException) pae.getException(); |
| 164 | + Path tmpFile = Files.createTempFile("jar_cache", null); |
| 165 | + try { |
| 166 | + Files.copy(in, tmpFile, StandardCopyOption.REPLACE_EXISTING); |
| 167 | + JarFile jarFile = new URLJarFile(tmpFile.toFile(), closeController, version); |
| 168 | + tmpFile.toFile().deleteOnExit(); |
| 169 | + return jarFile; |
| 170 | + } catch (Throwable thr) { |
| 171 | + try { |
| 172 | + Files.delete(tmpFile); |
| 173 | + } catch (IOException ioe) { |
| 174 | + thr.addSuppressed(ioe); |
| 175 | + } |
| 176 | + throw thr; |
| 177 | + } |
192 | 178 | } |
193 | | - |
194 | | - return result; |
195 | 179 | } |
196 | 180 |
|
197 | 181 | private class URLJarFileEntry extends JarEntry { |
|
0 commit comments