Putting an absolute path (eg, "/path/to/messages" under Unix) in either the <messages> or the <durables> section of the xml config file will cause an error because org.mom4j.config.ConfigImpl handles these incorrectly.
Replacing the getMessageStore() and getDurablesStore() methods with the following code fixed this for me:
public File getMessageStore() {
ConfigNode store = this.rootNode.findByName("messages");
return new File(store == null ? DEFAULT_STORE : store.getContent());
}
public File getDurablesStore() {
ConfigNode store = this.rootNode.findByName("durables");
return new File(store == null ? DEFAULT_DUR_STORE : store.getContent());
}
The current implementation seems unnecessarily complicated to me. Or am I missing something?
Logged In: NO
My solution was a bit more complicated:
public File getMessageStore() {
String s = DEFAULT_STORE;
ConfigNode store = this.rootNode.findByName("messages");
File f = new File(".");
File ret = null;
if(store == null) {
ret = new File(f.getAbsolutePath() +
System.getProperty("file.separator") +
s);
} else {
String path = store.getContent();
if (path.startsWith("/") == false) {
path = f.getAbsolutePath() + System.getProperty("file.separator") + path;
}
ret = new File(path);
}
return ret;
}
public File getDurablesStore() {
String s = DEFAULT_DUR_STORE;
ConfigNode store = this.rootNode.findByName("durables");
File f = new File(".");
File ret = null;
if(store == null) {
ret = new File(f.getAbsolutePath() +
System.getProperty("file.separator") +
s);
} else {
String path = store.getContent();
if (path.startsWith("/") == false) {
path = f.getAbsolutePath() + System.getProperty("file.separator") + path;
}
ret = new File(path);
}
return ret;
}