OxalisCommunity / Oxalis-AS4

PEPPOL AS4 pMode plugin for Oxalis
32 stars 25 forks source link

NullPointerException: little improvement #143

Open gozus19p opened 3 years ago

gozus19p commented 3 years ago

Hi all,

I am opening this issue with the intent to suggest a little improvement.

This morning I did some inbound tests. The sender produced an AS4 SOAP Envelope not suitable with OpenPEPPOL 4 corner scenario. He basically omitted UserMessage / MessageProperties field. If I am right, this field is defined as optional in OASIS standard, but it is mandatory in PEPPOL scenario because the receiver must verify its values (they must match with the ones defined in SBDH), referring to this.

Oxalis threw a NullPointerException on no.difi.oxalis.as4.inbound.As4InboundHandler:446:

private As4EnvelopeHeader parseAs4EnvelopeHeader(UserMessage userMessage) {
(...)
        as4EnvelopeHeader.setMessageProperties(userMessage.getMessageProperties().getProperty()
                .stream()
                .map(p -> new As4MessageProperty(p.getName(), p.getType(), p.getValue()))
                .collect(Collectors.toCollection(As4MessageProperties::new)));
(...)
}

I thought it would be useful to share this with you. Maybe this case could be handled throwing a checked Exception or something similar just to avoid NullPointerException.

The issue has been solved by fixing the sender's SOAP Envelope. I opened this on GitHub just to share the case.

Oxalis AS4 plugin version: 4.1.9 (latest release available).

Have a nice day and stay safe! Manuel