[
https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633277#action_12633277
]
Markus Wiederkehr commented on MIME4J-73:
-----------------------------------------
What I meant was that the methods in MessageBuilder that implement the
ContentHandler interface should throw the same exceptions that are declared in
ContentHandler. Otherwise a subclass of MessageBuilder cannot throw these
exceptions. The class AbstractContentHandler in org.apache.james.mime4j.parser
does this the same way..
I don't think that there is anything wrong with ContentHandler though. The
methods that have an InputStream parameter (body, epilogue, preamble, raw)
throw an IOException in addition to the MimeException because something can go
wrong with the InputStream. IMO this is exactly as it should be regardless if
MimeException extends IOException or not.
> IllegalArgumentException in Message constructor when parsing erroneous message
> ------------------------------------------------------------------------------
>
> Key: MIME4J-73
> URL: https://issues.apache.org/jira/browse/MIME4J-73
> Project: JAMES Mime4j
> Issue Type: Bug
> Affects Versions: 0.4
> Reporter: Markus Wiederkehr
> Fix For: 0.5
>
> Attachments: mime4j-message-2.patch, mime4j-message.patch
>
>
> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]