Using mstor w/ Windows, I am able to connect to mbox stores (thanks to SO). And it would seem that I can read message pointers; I know this because whenever I iterate over the store, it iterates over the right number of messages. The problem is that no headers nor content is loading! Any idea?
Yes, I have the JavaMail stuff in the classpath (it comes in mstor's lib these days). And I'm even using it on one of mstor's sample files (imagined.mbox).
Thanks in advance.
My code:
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.setProperty("mstor.mbox.metadataStrategy", "xml");
Session session1 = Session.getDefaultInstance(props);
Session session = Session.getDefaultInstance(new Properties());
Store store = session.getStore(new URLName("mstor:C:/tmp/imagined.mbox"));
store.connect();
System.out.println(store.isConnected());
Folder inbox = store.getDefaultFolder(); // no subfolder here; even if there is an Inbox, I get the same thing...
inbox.open(Folder.READ_ONLY);
Message[] messages = inbox.getMessages();
for (Message m : messages) {
System.out.println(m.getSubject());
}
}
My typical result:
true (i.e., yes, I'm connected...)
null
null
null
null
After creating an instance of
Properties
calledproperties
, use the following to disable the cache:If you do this and try again, you should find you're able to call the accessor methods for subject, from, to etc without having to resort to the
m.saveChanges()
hack.