Commons Email
  1. Commons Email
  2. EMAIL-137

MimeMessageParser throws ClassCastException for HtmlEmail

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.3.3
    • Labels:
      None
    • Environment:

      Java 1.6 + Scala 2.10.3 + Play! 2.2.2

      Description

      MimeMessageParser throws ClassCastException when parsing just created and built HtmlEmail:

      java.lang.ClassCastException: javax.mail.internet.MimeMultipart cannot be cast to java.lang.String
      at org.apache.commons.mail.util.MimeMessageParser.parse(MimeMessageParser.java:176) ~[commons-email-1.3.2.jar:1.3.2]
      at org.apache.commons.mail.util.MimeMessageParser.parse(MimeMessageParser.java:85) ~[commons-email-1.3.2.jar:1.3.2]
      at utils.EmailSender$.emailForAutomation(EmailSender.scala:382) ~[classes/:na]

      Here is the test code:

      def emailForAutomation(email: HtmlEmail): String =

      { email.buildMimeMessage() val mimeMessage = email.getMimeMessage() val parser = new MimeMessageParser(mimeMessage) parser.parse() parser.getHtmlContent() }

        Activity

        Alex Kogan created issue -
        Hide
        Thomas Neidhart added a comment -

        Fixed in r1591128.

        The problem was that MimePart.isMimeType() was returning wrong results in case of empty content.

        The mime type detection has been improved, and the exception should not occur anymore.

        Thanks for the report!

        Show
        Thomas Neidhart added a comment - Fixed in r1591128. The problem was that MimePart.isMimeType() was returning wrong results in case of empty content. The mime type detection has been improved, and the exception should not occur anymore. Thanks for the report!
        Thomas Neidhart made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.3.3 [ 12326803 ]
        Resolution Fixed [ 1 ]
        Thomas Neidhart made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        9d 5h 57m 1 Thomas Neidhart 29/Apr/14 23:33
        Resolved Resolved Closed Closed
        70d 21h 43m 1 Thomas Neidhart 09/Jul/14 21:17

          People

          • Assignee:
            Unassigned
            Reporter:
            Alex Kogan
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development