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 bf3458d70b0f5a10f6ca11f48989702d79925563
Author: Emerson Pinter <e...@pinter.dev>
AuthorDate: Wed Jan 22 13:26:49 2025 -0300

    [JSPF-115] Fix NPE that causes hang
    
    This NPE happens when a PortUnreachableException (that doesn't have a
    message) is received in the exceptionally block, but other exceptions
    without a message also can trigger this bug. Also added the null check
    for e.getCause(), just in case.
---
 .../java/org/apache/james/jspf/executor/AsynchronousSPFExecutor.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/resolver/src/main/java/org/apache/james/jspf/executor/AsynchronousSPFExecutor.java
 
b/resolver/src/main/java/org/apache/james/jspf/executor/AsynchronousSPFExecutor.java
index af1991e..f0f9fe7 100644
--- 
a/resolver/src/main/java/org/apache/james/jspf/executor/AsynchronousSPFExecutor.java
+++ 
b/resolver/src/main/java/org/apache/james/jspf/executor/AsynchronousSPFExecutor.java
@@ -84,10 +84,10 @@ public class AsynchronousSPFExecutor implements SPFExecutor 
{
                     }
                 })
                 .exceptionally(e -> {
-                    if (e instanceof CompletionException) {
+                    if (e instanceof CompletionException && e.getCause() != 
null) {
                         e = e.getCause();
                     }
-                    if (e instanceof IOException && 
e.getMessage().startsWith("Timed out ")) {
+                    if (e instanceof IOException && e.getMessage() != null && 
e.getMessage().startsWith("Timed out ")) {
                         e = new TimeoutException(e.getMessage());
                     }
                     if (e instanceof NoSuchRRSetException) {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to