aleksey created JSPF-111:
----------------------------
Summary: NPE when setting SPFResult
Key: JSPF-111
URL: https://issues.apache.org/jira/browse/JSPF-111
Project: James jSPF
Issue Type: Bug
Components: Parser
Affects Versions: master
Environment: Java: 21
Spring Boot: 3.2.4
Reporter: aleksey
Hey, guys! Good to see you again. And I need your help again. When I am using
*apache-jspf-resolver* version *1.0.4* I am experiencing threads that start
spawning and hang in the *waiting* state. Here is a sample code that reproduces
the error:
{code:java}
import org.apache.james.jspf.executor.SPFResult;
import org.apache.james.jspf.impl.DefaultSPF;
import org.apache.james.jspf.impl.SPF;
class SpfVerifierTest {
public static void main(String[] args) {
String ipAddress = "103.52.180.162";
String hostName = "FMTA1-162.ncdelivery04.com";
String from =
"17191683732756478-181603-1-mxscout....@delivery.forumofsecrets.com";
final SPF spfChecker = new DefaultSPF();
spfChecker.setUseBestGuess(true);
SPFResult spfResult = spfChecker.checkSPF(ipAddress, from, hostName);
spfResult.getResult();
}
} {code}
java.util.concurrent.CompletionException is thrown when calling
{code:java}
dnsProbe.getRecordsAsync(cont.getRequest()){code}
The cause of this exception is org.xbill.DNS.lookup.NoSuchRRSetException.
Here are some details from the Intellj IDEA:
{code:java}
cause = {NoSuchRRSetException@6039} "org.xbill.DNS.lookup.NoSuchRRSetException"
name = {Name@6045} "eapi.world.netcorecloud.net."
type = 99
backtrace = {Object[7]@6046}
detailMessage = null
cause = {NoSuchRRSetException@6039} "org.xbill.DNS.lookup.NoSuchRRSetException"
stackTrace = {StackTraceElement[19]@6048}
depth = 19
suppressedExceptions = {Collections$EmptyList@6041} size = 0 {code}
This exception reaches the java.util.concurrent.CompletionStage#exceptionally
method inside the
org.apache.james.jspf.executor.AsynchronousSPFExecutor#handleCont method. Where
we're trying to set the spf result. But SPFSession contains null as the value
of the currentResultExpanded field so NullPointerException is thrown here:
{code:java}
org.apache.james.jspf.executor.SPFResult
private String generateHeader(String result, SPFSession spfData) {
...
if (result.equals(SPFErrorConstants.PASS_CONV)) { ... } // result is null
...
} {code}
This leaves FutureSPFResult in a broken state and causes the calling thread to
fall asleep forever.
It seems that the cause of this problem appeared with this
[commit|https://github.com/apache/james-jspf/commit/e188ef5db6a76dc687faa0d464eabc06c4896339]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]