INT-1839 fixed AbstractMailReceiver to be compliant with MailReceiver interface and throw javax.mail.MessagingException

This commit is contained in:
Oleg Zhurakousky
2011-03-24 07:54:17 -04:00
parent 26951c3a59
commit faee3ec1a6
2 changed files with 2 additions and 7 deletions

View File

@@ -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);
}

View File

@@ -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();