I have encountered a NPE while sending an outbound Peppol message because I relied on the @Nonnull annotation in IPhase4PeppolCertificateCheckResultHandler for the @Nonnull X509Certificate aAPCertificate parameter.
java.lang.NullPointerException: Cannot invoke "java.security.cert.X509Certificate.getSubjectX500Principal()" because "certificate" is null at
de.i.p.o.OutboundMessageProcessor.lambda$buildCertificateConsumer$3(OutboundMessageProcessor.java:160) at
com.helger.phase4.peppol.Phase4PeppolSender$AbstractPeppolUserMessageBuilder.finishFields(Phase4PeppolSender.java:801) at
com.helger.phase4.peppol.Phase4PeppolSender$Builder.finishFields(Phase4PeppolSender.java:1344) at
com.helger.phase4.sender.AbstractAS4MessageBuilder.sendMessage(AbstractAS4MessageBuilder.java:831) at
com.helger.phase4.sender.AbstractAS4UserMessageBuilder.sendMessageAndCheckForReceipt(AbstractAS4UserMessageBuilder.java:798)
Going through the code I can see where this is coming from:
Phase4PeppolSender.java(m_bCheckReceiverAPCertificate is false)
From this point onwards the certificate is declared as Nullable:
AS4EndpointDetailProviderPeppol.java
Hi Philip,
I have encountered a NPE while sending an outbound Peppol message because I relied on the
@Nonnull
annotation inIPhase4PeppolCertificateCheckResultHandler
for the@Nonnull X509Certificate aAPCertificate
parameter.Going through the code I can see where this is coming from:
Phase4PeppolSender.java
(m_bCheckReceiverAPCertificate
is false)From this point onwards the certificate is declared as Nullable:
AS4EndpointDetailProviderPeppol.java