Open nvsnvikram opened 1 year ago
Removing the throws MessagingException from addHeader/removeHeader of MimeMessage is not possible due to IMAPMessage and POP3Messaging extending MimeMessage and overriding those functions to throw a checked exception.
Some possible alternatives are:
Is your feature request related to a problem? Please describe. MimeMessage class has addHeader and removeHeader functions that throw MessagingException. But the underlying function does not throw these exceptions. This causes the callers to unnecessarily catch and discard the MessagingException or throw it back to callers.
Describe the solution you'd like Java allows sub classes to remove checked exceptions on overridden methods. Can we remove MessagingException on addHeader and removeHeader?
Describe alternatives you've considered
Additional context