Don't assume all persistence store use the same default directory.

This commit is contained in:
Hiram Chirino 2013-09-27 05:10:30 -04:00
parent 70c698f988
commit 28163a4065
1 changed files with 7 additions and 1 deletions

View File

@ -371,12 +371,18 @@ public class MultiKahaDBPersistenceAdapter extends LockableServiceSupport implem
private void configureDirectory(PersistenceAdapter adapter, String fileName) { private void configureDirectory(PersistenceAdapter adapter, String fileName) {
File directory = null; File directory = null;
if (MessageDatabase.DEFAULT_DIRECTORY.equals(adapter.getDirectory())) { File defaultDir = MessageDatabase.DEFAULT_DIRECTORY;
try {
defaultDir = adapter.getClass().newInstance().getDirectory();
} catch (Exception e) {
}
if (defaultDir.equals(adapter.getDirectory())) {
// not set so inherit from mkahadb // not set so inherit from mkahadb
directory = getDirectory(); directory = getDirectory();
} else { } else {
directory = adapter.getDirectory(); directory = adapter.getDirectory();
} }
if (fileName != null) { if (fileName != null) {
directory = new File(directory, fileName); directory = new File(directory, fileName);
} }