You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Markus Wiederkehr (JIRA)" <se...@james.apache.org> on 2008/09/16 16:34:48 UTC

[jira] Created: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

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.5
            Reporter: Markus Wiederkehr


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


[jira] Updated: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Markus Wiederkehr (JIRA)" <se...@james.apache.org>.
     [ 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


[jira] Commented: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633388#action_12633388 ] 

Oleg Kalnichevski commented on MIME4J-73:
-----------------------------------------

Patch (mime4j-message-2.patch) checked in. Many thanks, Markus

Oleg

> 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


[jira] Commented: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632947#action_12632947 ] 

Robert Burrell Donkin commented on MIME4J-73:
---------------------------------------------

+1

patch looks good to me

- robert

> 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.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


[jira] Resolved: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved MIME4J-73.
-------------------------------------

    Resolution: Fixed

Patch checked in. Feel free to re-open the issue if you find anything wrong with the patch.

Oleg

> 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.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


[jira] Commented: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632935#action_12632935 ] 

Robert Burrell Donkin commented on MIME4J-73:
---------------------------------------------

>Oleg Kalnichevski - 19/Sep/08 11:41 AM
>> * MimeException extends Exception
>
>+1. I generally like a clear distinction between protocol exceptions (usually fatal) and I/O exceptions (usually recoverable). 
> However, this can be potentially contentious and certainly should be discussed as a separate issue.

this is contentious please don't include this in the patch. i've created a separate issue for discussions https://issues.apache.org/jira/browse/MIME4J-77

> * Message(InputStream), Header(InputStream) and Field.parse(String) throw a MimeException instead of a runtime exception
>
>+1

+1

> * Message.MessageBuilder becomes a public static inner class so it can be subclassed
>
> +1. I would even suggest factoring MessageBuilder into a separate public class.

+1 should be separate public class

Robert 

> 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
>
>
> 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


[jira] Commented: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633403#action_12633403 ] 

Stefano Bagnara commented on MIME4J-73:
---------------------------------------

@Markus: sorry, I didn't see you already provided a patch when I wrote my previous comment. my bad!
@Oleg: great! JAMES never had a faster commiter :-)

> 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


[jira] Commented: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Markus Wiederkehr (JIRA)" <se...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631746#action_12631746 ] 

Markus Wiederkehr commented on MIME4J-73:
-----------------------------------------

I would like to do that, but before I write any patches I would like to reach a consensus on what should be done and how.

And there are also other things related to this issue. Take a look at the Message(InputStream) constructor. It catches the MimeException from ContentHandler and converts it into an IllegalStateException. In my opinion this is very ugly because as a rule of thumb runtime exceptions should be reserved for programming errors.

The programmer did not do anything wrong just because a certain MIME message happens to be malformed. So in this case a checked exception is required. And the MimeException thrown by ContentHandler seems to be perfectly suitable for this.

The same thing happens in the Header(InputStream) constructor too.

Speaking of MimeException, is it a good idea that it extends IOException? The MessagingException from javax.mail does not do that. I think a MimeException should indicate a malformed message and that has nothing to do with an I/O error.

So I propose the following changes:
 * MimeException extends Exception
 * Message(InputStream), Header(InputStream) and Field.parse(String) throw a MimeException instead of a runtime exception
 * Message.MessageBuilder becomes a public static inner class so it can be subclassed

What is your opinion?

> 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.5
>            Reporter: Markus Wiederkehr
>
> 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


[jira] Commented: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Markus Wiederkehr (JIRA)" <se...@james.apache.org>.
    [ 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Updated: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated MIME4J-73:
------------------------------------

    Affects Version/s:     (was: 0.5)
                       0.4
        Fix Version/s: 0.5

>  * MimeException extends Exception

+1. I generally like a clear distinction between protocol exceptions (usually fatal) and I/O exceptions (usually recoverable). However, this can be potentially contentious and certainly should be discussed as a separate issue. 

 * Message(InputStream), Header(InputStream) and Field.parse(String) throw a MimeException instead of a runtime exception

+1

 * Message.MessageBuilder becomes a public static inner class so it can be subclassed 

+1. I would even suggest factoring MessageBuilder into a separate public class.

Oleg

> 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
>
>
> 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


[jira] Commented: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633228#action_12633228 ] 

Stefano Bagnara commented on MIME4J-73:
---------------------------------------

Some of them declare IOException, some of them MimeException, some other none.

I guess all of them should throw the same stuff: should all of them throw MimeException (wrapping IOException if needed) or should all of them throw both exceptions? (This also depend on how we'll deal with MIME4J-77, but in the mean time we need a working temporary solution). ATM throwing IOException would suffice as MimeException is an IOException.

Maybe the simpler solution is to add "throws IOException" to every public method.

I tested this locally and this does not require any other change to mime4j, maybe this can be done in 0.5 before the vote with no further review, if others agree with this approach.


> 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


[jira] Updated: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated MIME4J-73:
------------------------------------

    Attachment: mime4j-message.patch

If I hear no complaints I'll commit this patch in a day or so. Please review and let me know if you find anything disagreeable.

Oleg

> 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.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


[jira] Commented: (MIME4J-73) IllegalArgumentException in Message constructor when parsing erroneous message

Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631505#action_12631505 ] 

Robert Burrell Donkin commented on MIME4J-73:
---------------------------------------------

I think I agree. Please contribute a 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.5
>            Reporter: Markus Wiederkehr
>
> 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