INT-1839 fixed AbstractMailReceiver to be compliant with MailReceiver interface and throw javax.mail.MessagingException
This commit is contained in:
@@ -219,7 +219,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl
|
||||
this.folder.open(this.folderOpenMode);
|
||||
}
|
||||
|
||||
public synchronized Message[] receive() {
|
||||
public Message[] receive() throws javax.mail.MessagingException{
|
||||
synchronized (this.initializationMonitor) {
|
||||
try {
|
||||
this.openFolder();
|
||||
@@ -281,10 +281,6 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl
|
||||
}
|
||||
return copiedMessages.toArray(new Message[]{});
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new org.springframework.integration.MessagingException(
|
||||
"failure occurred while receiving from folder", e);
|
||||
}
|
||||
finally {
|
||||
MailTransportUtils.closeFolder(this.folder, this.shouldDeleteMessages);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ import org.mockito.stubbing.Answer;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
@@ -418,7 +417,7 @@ public class ImapMailReceiverTests {
|
||||
public void run(){
|
||||
try {
|
||||
receiver.receive();
|
||||
} catch (MessagingException e) {
|
||||
} catch (javax.mail.MessagingException e) {
|
||||
if (e.getCause() instanceof NullPointerException){
|
||||
e.printStackTrace();
|
||||
failed.getAndIncrement();
|
||||
|
||||
Reference in New Issue
Block a user