You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2017/01/10 14:18:57 UTC
[42/50] [abbrv] james-project git commit: JAMES-1877 Avoid inspection
for SFE known and present on the ClassPath
JAMES-1877 Avoid inspection for SFE known and present on the ClassPath
This actually should improve the way return code is handled
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/aec9b2fc
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/aec9b2fc
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/aec9b2fc
Branch: refs/heads/master
Commit: aec9b2fc40b3f508c926a4432197a00a4aa0c540
Parents: b299e32
Author: Benoit Tellier <bt...@linagora.com>
Authored: Wed Dec 7 10:02:52 2016 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Tue Jan 10 18:14:26 2017 +0700
----------------------------------------------------------------------
.../remoteDelivery/EnhancedMessagingException.java | 15 +++++++++++++++
.../mailets/remoteDelivery/MailDelivrerTest.java | 2 --
2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/aec9b2fc/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/EnhancedMessagingException.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/EnhancedMessagingException.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/EnhancedMessagingException.java
index 44b40bd..61a7152 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/EnhancedMessagingException.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/EnhancedMessagingException.java
@@ -28,6 +28,9 @@ import javax.mail.internet.InternetAddress;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
+import com.sun.mail.smtp.SMTPAddressFailedException;
+import com.sun.mail.smtp.SMTPSendFailedException;
+import com.sun.mail.smtp.SMTPSenderFailedException;
public class EnhancedMessagingException {
@@ -76,6 +79,18 @@ public class EnhancedMessagingException {
}
private Optional<Integer> computeReturnCode() {
+ if (messagingException instanceof SMTPAddressFailedException) {
+ SMTPAddressFailedException addressFailedException = (SMTPAddressFailedException) this.messagingException;
+ return Optional.of(addressFailedException.getReturnCode());
+ }
+ if (messagingException instanceof SMTPSendFailedException) {
+ SMTPSendFailedException sendFailedException = (SMTPSendFailedException) this.messagingException;
+ return Optional.of(sendFailedException.getReturnCode());
+ }
+ if (messagingException instanceof SMTPSenderFailedException) {
+ SMTPSenderFailedException senderFailedException = (SMTPSenderFailedException) this.messagingException;
+ return Optional.of(senderFailedException.getReturnCode());
+ }
if (messagingException.getClass().getName().endsWith(".SMTPSendFailedException")
|| messagingException.getClass().getName().endsWith(".SMTPAddressSucceededException")) {
try {
http://git-wip-us.apache.org/repos/asf/james-project/blob/aec9b2fc/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerTest.java
index c96e9a1..477d945 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remoteDelivery/MailDelivrerTest.java
@@ -33,7 +33,6 @@ import org.apache.mailet.Mail;
import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,7 +71,6 @@ public class MailDelivrerTest {
assertThat(executionResult).isEqualTo(ExecutionResult.temporaryFailure(sfe));
}
- @Ignore("Return code is always ignored")
@Test
public void handleSenderFailedExceptionShouldReturnPermanentFailureWhenServerException() throws Exception {
Mail mail = FakeMail.builder().recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org