james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Wiederkehr (JIRA)" <server-...@james.apache.org>
Subject [jira] Updated: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message
Date Mon, 22 Sep 2008 11:18:44 GMT

     [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Markus Wiederkehr updated MIME4J-73:
------------------------------------

    Attachment: mime4j-message-2.patch

Thank you for fixing this. The patch looks good to me but there a few minor issues remaining.

MessageBuilder should declare that it throws MimeException in every method it implements from
ContentHandler. Otherwise a subclass may not throw this exception (and subclassing was the
whole purpose of making it a public class).

And the javadoc of Field.parse() is not up to date and the Header constructor should declare
the MimeException it now throws..

See the attached patch mime4j-message-2.patch.

> 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message