From a9fb361904db715ae1e4e5547ff4dc61a3e353b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Thu, 3 Apr 2014 17:35:13 +0200 Subject: [PATCH] 8039181: Persistent code store does not use absolute paths internally Reviewed-by: sundar, lagergren --- .../src/jdk/nashorn/internal/runtime/CodeStore.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nashorn/src/jdk/nashorn/internal/runtime/CodeStore.java b/nashorn/src/jdk/nashorn/internal/runtime/CodeStore.java index 1299c71f1f2..8f5959993cf 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/CodeStore.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/CodeStore.java @@ -70,16 +70,16 @@ final class CodeStore { * @throws IOException */ public CodeStore(final String path, final int minSize) throws IOException { - this.dir = new File(path); + this.dir = checkDirectory(path); this.minSize = minSize; - checkDirectory(this.dir); } - private static void checkDirectory(final File dir) throws IOException { + private static File checkDirectory(final String path) throws IOException { try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { + return AccessController.doPrivileged(new PrivilegedExceptionAction() { @Override - public Void run() throws IOException { + public File run() throws IOException { + final File dir = new File(path).getAbsoluteFile(); if (!dir.exists() && !dir.mkdirs()) { throw new IOException("Could not create directory: " + dir); } else if (!dir.isDirectory()) { @@ -87,7 +87,7 @@ final class CodeStore { } else if (!dir.canRead() || !dir.canWrite()) { throw new IOException("Directory not readable or writable: " + dir); } - return null; + return dir; } }); } catch (PrivilegedActionException e) {