(geronimo-mail) 03/04: Connect the store in Session.getFolder(URLName)

[email protected] Sat, 18 Jul 2026 08:28:01 +0000
Newsgroups gmane.comp.java.geronimo.cvs
Message-ID <[email protected]>
This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch mail-tck
in repository https://gitbox.apache.org/repos/asf/geronimo-mail.git

commit 3c98922611fbc37bde4c1ad0ada50bff9aac3eb3
Author: Richard Zowalla <[email protected]>
AuthorDate: Sat Jul 18 10:27:41 2026 +0200

    Connect the store in Session.getFolder(URLName)
    
    The API contract requires the returned (closed) folder to come from a
    connected store, authenticated with the credentials embedded in the URLName.
    Found by the Jakarta Mail TCK's fpopulate tool, which relies on this
    behaviour.
---
 geronimo-mail_2.1_spec/src/main/java/jakarta/mail/Session.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/geronimo-mail_2.1_spec/src/main/java/jakarta/mail/Session.java b/geronimo-mail_2.1_spec/src/main/java/jakarta/mail/Session.java
index eaca0ec..1fcb1b6 100644
--- a/geronimo-mail_2.1_spec/src/main/java/jakarta/mail/Session.java
+++ b/geronimo-mail_2.1_spec/src/main/java/jakarta/mail/Session.java
@@ -317,6 +317,9 @@ public final class Session {
      */
     public Folder getFolder(final URLName name) throws MessagingException {
         final Store store = getStore(name);
+        // the API contract requires the returned (closed) folder to come from a
+        // connected store, using the credentials embedded in the URLName
+        store.connect();
         return store.getFolder(name);
     }