aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannesw <none@none>2014-04-03 17:35:13 +0200
committerhannesw <none@none>2014-04-03 17:35:13 +0200
commit937145d4660750c9acd2de3dd58ec54c27273109 (patch)
treef5f4caf4d83455200a32673e545c5dd9d784c0a8 /src
parent858b18094bcabce4ecc1707c4fe127417914fa78 (diff)
downloadnashorn-937145d4660750c9acd2de3dd58ec54c27273109.tar.gz
8039181: Persistent code store does not use absolute paths internally
Reviewed-by: sundar, lagergren
Diffstat (limited to 'src')
-rw-r--r--src/jdk/nashorn/internal/runtime/CodeStore.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/jdk/nashorn/internal/runtime/CodeStore.java b/src/jdk/nashorn/internal/runtime/CodeStore.java
index 1299c71f..8f595999 100644
--- a/src/jdk/nashorn/internal/runtime/CodeStore.java
+++ b/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<Void>() {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<File>() {
@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) {