|
16 | 16 | import java.io.IOException; |
17 | 17 | import java.math.BigInteger; |
18 | 18 | import java.nio.file.Files; |
19 | | -import java.nio.file.InvalidPathException; |
20 | 19 | import java.nio.file.Path; |
21 | | -import java.nio.file.Paths; |
22 | 20 | import java.security.MessageDigest; |
23 | 21 | import java.security.NoSuchAlgorithmException; |
24 | 22 | import java.util.ArrayList; |
25 | 23 | import java.util.HashSet; |
26 | 24 | import java.util.List; |
27 | 25 | import java.util.Set; |
| 26 | +import java.util.UUID; |
28 | 27 | import java.util.jar.Attributes; |
29 | 28 | import java.util.jar.JarOutputStream; |
30 | 29 | import java.util.jar.Manifest; |
|
33 | 32 |
|
34 | 33 | import org.apache.commons.lang3.ArrayUtils; |
35 | 34 |
|
36 | | -import sun.security.action.GetPropertyAction; |
37 | | - |
38 | 35 | public class LaunchUtils { |
39 | 36 | private static Set<Path> tempFilesInUse = new HashSet<>(); |
40 | 37 |
|
@@ -109,16 +106,12 @@ public static void releaseTempLaunchFile(Path tempFile) { |
109 | 106 |
|
110 | 107 | private static synchronized Path getTmpDir() throws IOException { |
111 | 108 | if (tmpdir == null) { |
| 109 | + Path tmpfile = Files.createTempFile("", UUID.randomUUID().toString()); |
| 110 | + tmpdir = tmpfile.getParent(); |
112 | 111 | try { |
113 | | - tmpdir = Paths.get(java.security.AccessController.doPrivileged(new GetPropertyAction("java.io.tmpdir"))); |
114 | | - } catch (NullPointerException | InvalidPathException e) { |
115 | | - Path tmpfile = Files.createTempFile("", ".tmp"); |
116 | | - tmpdir = tmpfile.getParent(); |
117 | | - try { |
118 | | - Files.deleteIfExists(tmpfile); |
119 | | - } catch (Exception ex) { |
120 | | - // do nothing |
121 | | - } |
| 112 | + Files.deleteIfExists(tmpfile); |
| 113 | + } catch (Exception ex) { |
| 114 | + // do nothing |
122 | 115 | } |
123 | 116 | } |
124 | 117 |
|
|
0 commit comments