Uploaded image for project: 'James Mime4j'
  1. James Mime4j
  2. MIME4J-73

IllegalArgumentException in Message constructor when parsing erroneous message

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.4
    • 0.5
    • None
    • None

    Description

      The constructor of Message(InputStream) uses its inner class MessageBuilder to parse the input stream and create the object. The method MessageBuilder.field(String) calls Field.parse(String) to parse header fields. This method throws an IllegalArgumentException on parse errors.

      Clearly the Message constructor should throw a MimeException instead of an IllegalArgumentException if an invalid header field is encountered (or else it should simply ignore the field). So either Field.parse(String) should throw a MimeException or MessageBuilder.field(String) should catch and convert it.

      And by the way, could you make MessageBuilder public so it can be extended if a slightly different behavior is desired.

      Attachments

        1. mime4j-message-2.patch
          5 kB
          Markus Wiederkehr
        2. mime4j-message.patch
          24 kB
          Oleg Kalnichevski

        Issue Links

          Activity

            People

              Unassigned Unassigned
              wmax Markus Wiederkehr
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: