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 "Robert Burrell Donkin (JIRA)" <se...@james.apache.org> on 2008/09/20 12:53:44 UTC
[jira] Created: (MIME4J-77) Decide Whether MimeException should
extend IOException
Decide Whether MimeException should extend IOException
------------------------------------------------------
Key: MIME4J-77
URL: https://issues.apache.org/jira/browse/MIME4J-77
Project: JAMES Mime4j
Issue Type: Task
Affects Versions: 0.5
Reporter: Robert Burrell Donkin
Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632943#action_12632943 ]
Robert Burrell Donkin commented on MIME4J-77:
---------------------------------------------
If anyone disagrees and thinks it needs to be addressed now, switch it back.
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633068#action_12633068 ]
Oleg Kalnichevski commented on MIME4J-77:
-----------------------------------------
> My estimation is that advanced users working at a low level are more likely to care about recovery whereas users working at a high level are unlikely to care. So I think that this approach is worthwhile.
Robert et al,
That's the approach we chose for HttpClient 4.0. All core and client components make a clear distinction between IOExceptions and HttpExceptions. The former are considered recoverable, the latter are not. At the topmost level (that is, in the HttpClient class, which is what the overwhelming majority of users are likely to interact with) HttpExceptions are caught and re-thrown as special subclass of IOException. All seem happy.
We could make MimeException a separate class of exceptions distinct from IOException in all low level components and then catch MimeExcetions in the Message class and rethrow them as IOException.
Oleg
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644525#action_12644525 ]
Robert Burrell Donkin commented on MIME4J-77:
---------------------------------------------
Markus - Mime4j is a IO library. One fault shared by many early attempts at java libraries was a proliferation of meaningless top level exceptions. The top level API of an IO library should throw IOExceptions.
Oleg - I'm happy to follow the strategy you outline. I think that there are some corner cases where it might be difficult to distinguish between the cases (recoverable and not) but I don't think this should be a major worry.
Commiting this patch is fine by me.
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
> Attachments: mimeex.patch
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski updated MIME4J-77:
------------------------------------
Attachment: mimeex.patch
Here's the patch for your consideration.
* MimeException no longer extends IOException
* Message and Field constructors rethrow MimeExceptions as MimeIOExceptions enabling the user to implement a simple exception recovery with a single catch clause
Please review
Oleg
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
> Attachments: mimeex.patch
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644503#action_12644503 ]
Oleg Kalnichevski commented on MIME4J-77:
-----------------------------------------
Folks,
Are there any objections to committing this patch?
Oleg
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
> Attachments: mimeex.patch
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Markus Wiederkehr (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644535#action_12644535 ]
Markus Wiederkehr commented on MIME4J-77:
-----------------------------------------
@Robert:
You are using one Java class (IOException in this case) for two completely unrelated classes of errors that can occur when loading a message: true I/O errors and parsing errors in case of malformed messages. This invites the user to be sloppy with the error handling. Or worse, the user may not even become aware of the fact that there are two classes of errors if he/she does not study the API carefully enough.
Using only one exception and a subclass instead of two independent exceptions is a bit unconventional, you said so yourself. It is certainly not what I would expect, but I can live with it.
If you decide to stick to this decision Oleg's patch is a good compromise because it eliminates the is-a relationship between MimeException and IOException by introducing a third class MimeIOException that serves as an adapter.
@Oleg:
Please include a getter in MimeIOException to retrieve the underlying MimeException without having to cast.
I think you should also declare "throws MimeIOException, IOException" where appropriate (Header and Message). This has the advantage that an IDE like Eclipse can create a catch block for MimeIOException automatically.
Also your patch does not seem to cover MaxLineLimitException.
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
> Attachments: mimeex.patch
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Burrell Donkin updated MIME4J-77:
----------------------------------------
Fix Version/s: 0.5
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.5
> Reporter: Robert Burrell Donkin
> Fix For: 0.5
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved MIME4J-77.
-------------------------------------
Resolution: Fixed
Patch checked in
Oleg
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
> Attachments: mimeex.patch
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632934#action_12632934 ]
Robert Burrell Donkin commented on MIME4J-77:
---------------------------------------------
>From https://issues.apache.org/jira/browse/MIME4J-73:
Markus Wiederkehr:
> 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.
Oleg Kalnichevski:
>> * 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.
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.5
> Reporter: Robert Burrell Donkin
> Fix For: 0.5
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632942#action_12632942 ]
Robert Burrell Donkin commented on MIME4J-77:
---------------------------------------------
Addressing in 0.6 is fine by me
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Oleg Kalnichevski (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski updated MIME4J-77:
------------------------------------
Affects Version/s: (was: 0.5)
0.4
Fix Version/s: (was: 0.5)
0.6
Robert,
This would be a pretty major change. Is it okay if we address the issue in 0.6?
Oleg
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632941#action_12632941 ]
Robert Burrell Donkin commented on MIME4J-77:
---------------------------------------------
Two separate exception hierarchies separating possibly recoverable I/O exceptions from probably fatal protocol exceptions is the conventional approach. Mime4j previously used this approach. MimeException was switched to subclass IOException between 0.4 to trial an less conventional approach with the advantage of a more concise API.
At the very least, since this approach is unconventional it should be well documented.
The argument in favour of a single hierarchy is that it allows a more concise and maintainable API.
In use cases where the user does not care about recovery, at most a single catch is needed. This catch is a general java exception (as opposed to a mime4j one) so in many typical use cases, a single general (ie not library specific) catch or throws will suffice.
This approach has the disadvantage that the correct exception to catch in use cases when the user cares about recovery is not self-documenting. In other words, the API is less obvious for these cases. The user will need to consult the Mime4J documentation and catch then rethrow or handle the MimeException.
My estimation is that advanced users working at a low level are more likely to care about recovery whereas users working at a high level are unlikely to care. So I think that this approach is worthwhile.
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
>
> Decide whether MimeException should extend IOException
--
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-77) Decide Whether MimeException should
extend IOException
Posted by "Markus Wiederkehr (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/MIME4J-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633218#action_12633218 ]
Markus Wiederkehr commented on MIME4J-77:
-----------------------------------------
My concern is mainly that extending a class means establishing an is-a relationship. And in my opinion a MimeException simply is not an IOException.
That being said it don't think it's a major issue. If I know I have to catch MimeException before catching IOException then all works well. And users who don't need to distinguish can simply catch IOException and be done with it.
If you decide to leave it as it is I think the API should properly declare the MimeException wherever it is thrown. What I mean is a method or constructor should declare "throws MimeException, IOException" instead of simply declaring "throws IOException". This can be easily checked by temporarily changing the super class of MimeException to Exception and running the compiler.
> Decide Whether MimeException should extend IOException
> ------------------------------------------------------
>
> Key: MIME4J-77
> URL: https://issues.apache.org/jira/browse/MIME4J-77
> Project: JAMES Mime4j
> Issue Type: Task
> Affects Versions: 0.4
> Reporter: Robert Burrell Donkin
> Fix For: 0.6
>
>
> Decide whether MimeException should extend IOException
--
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