Thu, 03 Apr 2014 17:35:13 +0200
8039181: Persistent code store does not use absolute paths internally
Reviewed-by: sundar, lagergren
src/jdk/nashorn/internal/runtime/CodeStore.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/jdk/nashorn/internal/runtime/CodeStore.java Wed Apr 02 18:26:57 2014 +0200 1.2 +++ b/src/jdk/nashorn/internal/runtime/CodeStore.java Thu Apr 03 17:35:13 2014 +0200 1.3 @@ -70,16 +70,16 @@ 1.4 * @throws IOException 1.5 */ 1.6 public CodeStore(final String path, final int minSize) throws IOException { 1.7 - this.dir = new File(path); 1.8 + this.dir = checkDirectory(path); 1.9 this.minSize = minSize; 1.10 - checkDirectory(this.dir); 1.11 } 1.12 1.13 - private static void checkDirectory(final File dir) throws IOException { 1.14 + private static File checkDirectory(final String path) throws IOException { 1.15 try { 1.16 - AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { 1.17 + return AccessController.doPrivileged(new PrivilegedExceptionAction<File>() { 1.18 @Override 1.19 - public Void run() throws IOException { 1.20 + public File run() throws IOException { 1.21 + final File dir = new File(path).getAbsoluteFile(); 1.22 if (!dir.exists() && !dir.mkdirs()) { 1.23 throw new IOException("Could not create directory: " + dir); 1.24 } else if (!dir.isDirectory()) { 1.25 @@ -87,7 +87,7 @@ 1.26 } else if (!dir.canRead() || !dir.canWrite()) { 1.27 throw new IOException("Directory not readable or writable: " + dir); 1.28 } 1.29 - return null; 1.30 + return dir; 1.31 } 1.32 }); 1.33 } catch (PrivilegedActionException e) {