jakartaee / jakartaee/mail-api

Custom mail providers distributed under META-INF/javamail.properties are no longer loaded with Jakarta Mail 2.1.5

Open
#812 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
285
Forks
109
Avg merge
15h 19m
Merged PRs (30d)
1

Description

**Describe the bug**
Jakarta Mail 2.1.5 is not backward compatible with how custom providers distributed by the application are loaded. Providers declared under `META-INF/javamail.properties` are no longer loaded; users are now forced to rename the file to `META-INF/jakarta.properties` instead. I understand it as a backward compatibility issue.

**To Reproduce**
See reproducer attached to this issue, it is just a test case that loads the session and tries to assert that the custom providers declared on `META-INF/javamail.properties` are available from Session.getProviders()

[mail-reproducer.zip](https://github.com/user-attachments/files/22514615/mail-reproducer.zip)

**Expected behavior**
Custom providers distributed via `META-INF/javamail.properties` are loaded.

**Additional context**
This issue was introduced via [here](https://github.com/jakartaee/mail-api/commit/223c35043429a738320f86abe70c75be1efe7f01#diff-5cbee3986400643f15064c1c111133ea02d864c75ed3ad777d192159f8f6ea89R1285-R1287). As soon as the providers coming from the `META-INF/jakarta.properties` that are available on the classloader via Angus Mail are processed, the for loop is broken and the code skips processing other possible providers distributed by the application via `META-INF/javamail.properties`

Contributor guide

Open the contributing guide

Research direction

Start with the attached mail-reproducer.zip and the provider-loading code changed in commit 223c35043429a738320f86abe70c75be1efe7f01. Run the test that creates a session and checks Session.getProviders(), then trace processing of META-INF/jakarta.properties and META-INF/javamail.properties. Done means application-provided providers from META-INF/javamail.properties are available again.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.