(james-jspf) 04/06: The result from async should be temperror when a SocketException happens

[email protected]
Newsgroups gmane.comp.jakarta.james.devel
Message-ID <[email protected]>
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-jspf.git

commit ae7e71a8c3d8e1608ad54b613b30a8d31e3170f5
Author: Emerson Pinter <[email protected]>
AuthorDate: Wed Jan 22 13:39:25 2025 -0300

    The result from async should be temperror when a SocketException happens
    
    Situations like a port unreachable should be considered a temperror by
    async executor, like the sync does.
---
 resolver/src/main/java/org/apache/james/jspf/impl/SPF.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java b/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java
index 3cfc6f1..4c8f955 100644
--- a/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java
+++ b/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java
@@ -20,6 +20,7 @@
 
 package org.apache.james.jspf.impl;
 
+import java.net.SocketException;
 import java.util.Iterator;
 import java.util.LinkedList;
 
@@ -287,6 +288,10 @@ public class SPF implements SPFChecker {
             } else if(exception instanceof NoSuchDomainException) {
                 LOGGER.error(exception.getMessage(), exception);
                 result = SPFErrorConstants.NONE_CONV;
+            } else if (exception instanceof SocketException) {
+                //SocketException or PortUnreachableException can be caused by a temporary issue
+                LOGGER.error(exception.getMessage(), exception);
+                result = SPFErrorConstants.TEMP_ERROR_CONV;
             } else {
                 // this should never happen at all. But anyway we will set the
                 // result to neutral. Safety first ..
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.