File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
spring-integration-mail/src
main/java/org/springframework/integration/mail
test/java/org/springframework/integration/mail Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2024 the original author or authors.
2+ * Copyright 2002-2025 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
6969 * @author Yuxin Wang
7070 * @author Ngoc Nhan
7171 * @author Filip Hrisafov
72+ * @author Jiandong Ma
7273 */
7374public abstract class AbstractMailReceiver extends IntegrationObjectSupport implements MailReceiver , DisposableBean {
7475
@@ -370,6 +371,9 @@ protected void openFolder() throws MessagingException {
370371 }
371372
372373 private Folder obtainFolderInstance () throws MessagingException {
374+ if (this .url == null ) {
375+ return this .store .getDefaultFolder ();
376+ }
373377 return this .store .getFolder (this .url );
374378 }
375379
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2014-2022 the original author or authors.
2+ * Copyright 2014-2025 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2222import jakarta .mail .Message ;
2323import jakarta .mail .Session ;
2424import jakarta .mail .Store ;
25- import jakarta .mail .URLName ;
2625import org .junit .jupiter .api .Test ;
2726
2827import org .springframework .beans .DirectFieldAccessor ;
@@ -68,7 +67,7 @@ protected Message[] searchForNewMessages() {
6867 Folder folder = mock (Folder .class );
6968 when (folder .exists ()).thenReturn (true );
7069 when (folder .isOpen ()).thenReturn (false , true );
71- doReturn (folder ).when (store ).getFolder (( URLName ) null );
70+ doReturn (folder ).when (store ).getDefaultFolder ( );
7271 doNothing ().when (store ).connect ();
7372 receiver .openFolder ();
7473 receiver .openFolder ();
You can’t perform that action at this time.
0 commit comments