Re: clueless newbie -- how to open mbox?

Matej Cepl <[email protected]> Wed, 02 May 2007 20:51:43 +0200
Newsgroups gmane.comp.java.classpath.extensions.javamail
Organization Red Hat Czech, s.r.o.
Message-ID <[email protected]>
On 2007-05-02, 18:39 GMT, Matej Cepl wrote:
> OK, I got your point (and you are probably right, I just hoped 
> it actually works this way a minute I begun to think about set 
> of folders), but still no luck. However, I have a different 
> exception now ;-):

When (following http://tinyurl.com/ysqmfx ) I tried other 
variant, I got back to the square one:

[matej@hubmaier kmail2tbfolders]$ cat -b test.java
     1  import java.util.*;
     2  import javax.mail.*;

     3  public class test {
     4          public static void main(String[] args) throws 
                MessagingException {
     5                  String urlStr 
                        = ``/home/matej/.eclipse/workspace\
            /kmail2tbfolders/examples/``';
     6                  Session session = Session.getInstance(new 
                        Properties());
     7                  URLName storeURL = new 
                        URLName(``'mbox://``'+urlStr);
     8                  Store store 
                        = session.getStore(storeURL);
     9                  Folder test 
                        = store.getDefaultFolder();
    10                  test = test.getFolder(``'test``');
    11                  test.open(Folder.READ_WRITE);
    12                  try {    13              
                        test.open(Folder.READ_WRITE);
    14          } catch (MessagingException ex) {
    15                  test.open(Folder.READ_ONLY);
    16          }
    17          }
    18  }
[matej@hubmaier kmail2tbfolders]$ gcj -C test.java 
[matej@hubmaier kmail2tbfolders]$ gij test
Exception in thread ``'main``' 
java.lang.NullPointerException
   at test.main(test.java:11)
[matej@hubmaier kmail2tbfolders]$