How to Handle Missing com.sun.mail.iap.ParsingException Equivalent in Jakarta Mail API?

57 Views Asked by At

I recently migrated my Java application from using javax.mail:mail version 1.5.0-b01 to jakarta.mail:jakarta.mail-api version 2.1.2. However, I've encountered an issue regarding exception handling that I need some help with.

In my previous implementation, I was using com.sun.mail.iap.ParsingException from the javax.mail package. This exception was crucial in handling specific parsing errors related to mail protocols. After switching to the newer jakarta.mail:jakarta.mail-api, I found that com.sun.mail.iap.ParsingException is no longer available.

The available packages in jakarta.mail are event, internet, search, and util. I looked into jakarta.mail.internet.ParseException, but it seems to serve a more general purpose and is not a direct replacement for com.sun.mail.iap.ParsingException.

I'm seeking advice on how best to adapt my exception handling to this change. Specifically:

Is there a direct or close equivalent to com.sun.mail.iap.ParsingException in the Jakarta Mail API that I might have overlooked?

If not, what are the recommended practices for handling the specific type of parsing exceptions previously covered by com.sun.mail.iap.ParsingException using the Jakarta Mail API?

Are there any specific patterns or practices in Jakarta Mail for dealing with low-level parsing errors, or should I implement custom error handling?

Any insights, code snippets, or references to relevant documentation would be greatly appreciated. Thank you in advance for your help!

1

There are 1 best solutions below

0
jmehrens On

From the Angus Mail COMPAT.txt

-- Angus Mail 2.0.0 --

  • Java package and java module names changed

    To different this project from its origin and match current maven coordinates and project name, java package and module names were renamed to start with "org.eclipse.angus.mail.". The same applies to supported property names.

So this means that the com.sun.mail.iap.ParsingException is now org.eclipse.angus.mail.iap.ParsingException.

I recently migrated my Java application from using javax.mail:mail version 1.5.0-b01 to jakarta.mail:jakarta.mail-api version 2.1.2.

You should read the JakartaMail COMPAT.txt and the Angus Mail COMPAT.txt (from above) to see what other things have changed between 1.5.0-b01 and 2.1.2. that could impact your code base.