mguessan / davmail

DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway - Synced with main subversion repository at
http://davmail.sourceforge.net
GNU General Public License v2.0
582 stars 86 forks source link

Javax.mail casting errors #339

Closed chriskanan closed 8 months ago

chriskanan commented 8 months ago

I'm getting some errors, which seem to be related to javax.mail and casting with an imap setup.

591 ERROR [ImapConnection] davmail  - class javax.mail.util.SharedByteArrayInputStream cannot be cast to class javax.mail.internet.MimeMessage (javax.mail.util.SharedByteArrayInputStream and javax.mail.internet.MimeMessage are in unnamed module of loader 'app')
java.lang.ClassCastException: class javax.mail.util.SharedByteArrayInputStream cannot be cast to class javax.mail.internet.MimeMessage (javax.mail.util.SharedByteArrayInputStream and javax.mail.internet.MimeMessage are in unnamed module of loader 'app')
        at davmail.imap.ImapConnection.appendBodyStructure(ImapConnection.java:1404)
        at davmail.imap.ImapConnection.appendBodyStructure(ImapConnection.java:1304)
        at davmail.imap.ImapConnection.appendBodyStructure(ImapConnection.java:1281)
        at davmail.imap.ImapConnection.handleFetch(ImapConnection.java:894)
        at davmail.imap.ImapConnection.run(ImapConnection.java:332)

308 ERROR [ImapConnection-49752] davmail  - class javax.mail.util.SharedByteArrayInputStream cannot be cast to class javax.mail.internet.MimeMessage (javax.mail.util.SharedByteArrayInputStream and javax.mail.internet.MimeMessage are in unnamed module of loader 'app')
java.lang.ClassCastException: class javax.mail.util.SharedByteArrayInputStream cannot be cast to class javax.mail.internet.MimeMessage (javax.mail.util.SharedByteArrayInputStream and javax.mail.internet.MimeMessage are in unnamed module of loader 'app')
mguessan commented 8 months ago

Probably a malformed message, adding a failover case to avoid exception