if the container name has '/' in it then make sure we create the parent directories before we try to access the file.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@573392 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-09-06 22:05:43 +00:00
parent 1301501a0a
commit 838e9a42b4
3 changed files with 3 additions and 0 deletions

View File

@ -177,6 +177,7 @@ public final class IndexManager {
protected void initialize() throws IOException { protected void initialize() throws IOException {
file = new File(directory, NAME_PREFIX + IOHelper.toFileSystemSafeName(name) ); file = new File(directory, NAME_PREFIX + IOHelper.toFileSystemSafeName(name) );
file.getParentFile().mkdirs();
indexFile = new RandomAccessFile(file, mode); indexFile = new RandomAccessFile(file, mode);
reader = new StoreIndexReader(indexFile); reader = new StoreIndexReader(indexFile);
writer = new StoreIndexWriter(indexFile, name, redoLog); writer = new StoreIndexWriter(indexFile, name, redoLog);

View File

@ -392,6 +392,7 @@ public class HashIndex implements Index {
private void openIndexFile() throws IOException { private void openIndexFile() throws IOException {
if (indexFile == null) { if (indexFile == null) {
file = new File(directory, NAME_PREFIX + IOHelper.toFileSystemSafeName(name)); file = new File(directory, NAME_PREFIX + IOHelper.toFileSystemSafeName(name));
file.getParentFile().mkdirs();
indexFile = new RandomAccessFile(file, "rw"); indexFile = new RandomAccessFile(file, "rw");
} }
} }

View File

@ -407,6 +407,7 @@ public class TreeIndex implements Index {
protected void openIndexFile() throws IOException { protected void openIndexFile() throws IOException {
if (indexFile == null) { if (indexFile == null) {
file = new File(directory, NAME_PREFIX + IOHelper.toFileSystemSafeName(name)); file = new File(directory, NAME_PREFIX + IOHelper.toFileSystemSafeName(name));
file.getParentFile().mkdirs();
indexFile = new RandomAccessFile(file, "rw"); indexFile = new RandomAccessFile(file, "rw");
} }
} }