Question

I am trying to use the JavaMail API and using it in text when just fine. Printing out all my emails subjects in the cmd. So I wanted to implement it into a GUI.

For some reason though, I get a null error, even though I debugged the program and find that the array it uses to fill the DefaultTableModel is indeed full of stuff.

It seems to happen when the application is about to put the information in the model itself:

    try {
        for(Message m : message) {
            model.addRow(new Object[]{m.getFrom(), m.getSubject(), (m.getFlags().contains(Flags.Flag.SEEN) ? "Yes" : "No")});
        }
    } catch (MessagingException ex) {
        JOptionPane.showMessageDialog(paneParent, "An Error Occured:\n" + ex.getMessage(),
                "Error", JOptionPane.ERROR_MESSAGE);
    }

Any idea why this might happen? The array is not empty. I checked it.

Was it helpful?

Solution

Problem solved.

I was an idiot for not checking the StackTrace. It held the "FolderClosedException" which led me to the solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top