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
The following commit(s) were added to refs/heads/master by this push:
new 512e89a [FIX] AsynchronousSPFExecutor should handle null continuation
and CompletionExceotions
512e89a is described below
commit 512e89ae46b5bc2056780e01898e0cd93d980d8f
Author: Benoit Tellier <[email protected]>
AuthorDate: Fri Dec 9 09:41:48 2022 +0700
[FIX] AsynchronousSPFExecutor should handle null continuation and
CompletionExceotions
---
.../jspf/executor/AsynchronousSPFExecutor.java | 24 +++++++++++++++-------
1 file changed, 17 insertions(+), 7 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 ac8836d..2ec4e9d 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
@@ -54,9 +54,12 @@ public class AsynchronousSPFExecutor implements SPFExecutor {
while ((checker = session.popChecker()) != null) {
// only execute checkers we added (better recursivity)
LOGGER.debug("Executing checker: {}", checker);
- final SPFChecker finalChecker = checker;
+ SPFChecker finalChecker = checker;
try {
- final DNSLookupContinuation cont = checker.checkSPF(session);
+ DNSLookupContinuation cont = checker.checkSPF(session);
+ if (cont == null) {
+ continue;
+ }
// if the checker returns a continuation we return it
dnsProbe.getRecordsAsync(cont.getRequest())
.thenAccept(results -> {
@@ -68,11 +71,10 @@ public class AsynchronousSPFExecutor implements SPFExecutor
{
})
.exceptionally(e -> {
if (e instanceof TimeoutException) {
- try {
- cont.getListener().onDNSResponse(new
DNSResponse((TimeoutException) e), session);
- } catch (PermErrorException | NoneException |
TempErrorException | NeutralException ex2) {
- handleError(session, finalChecker, ex2);
- }
+ handleTimeout(session, finalChecker, cont,
(TimeoutException) e);
+ }
+ if (e.getCause() instanceof TimeoutException) {
+ handleTimeout(session, finalChecker, cont,
(TimeoutException) e.getCause());
}
return null;
});
@@ -83,6 +85,14 @@ public class AsynchronousSPFExecutor implements SPFExecutor {
result.setSPFResult(session);
}
+ private void handleTimeout(SPFSession session, SPFChecker finalChecker,
DNSLookupContinuation cont, TimeoutException e) {
+ try {
+ cont.getListener().onDNSResponse(new DNSResponse(e), session);
+ } catch (PermErrorException | NoneException | TempErrorException |
NeutralException ex2) {
+ handleError(session, finalChecker, ex2);
+ }
+ }
+
private void handleError(SPFSession session, SPFChecker checker, Exception
e) {
while (e != null) {
while (checker == null || !(checker instanceof
SPFCheckerExceptionCatcher)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]