holodeck-b2b / rest-backend

An extension for Holodeck B2B that implements the Submit, Notify and Deliver operations using a REST API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NullPointerException for AS2 reception

sopgreg opened this issue · comments

For incoming AS2 messages that should be delivered using the NotifyAndDeliverOperation, a NullPointerException is thrown:

(HttpConnection-8089-1)[DEBUG] org.holodeckb2b.backend.rest.NotifyAndDeliverOperation - Preparing User Message for delivery to back-end
(HttpConnection-8089-1)[WARN ] org.holodeckb2b.msgproc.core.RESPONSE_IN_FLOW.DeliverUserMessage - NandDDeliverer threw NullPointerException instead of MessageDeliveryException!
(HttpConnection-8089-1)[ERROR] org.holodeckb2b.msgproc.core.RESPONSE_IN_FLOW.DeliverUserMessage - Could not deliver the user message [msgId=xxx] using specified delivery method!

Reason is, that no collaboration info is set on the incoming AS2 user message in NotifyAndDeliverOperation:140:

headers.setHeader(HTTPHeaders.CONVERSATION_ID, userMsg.getCollaborationInfo().getConversationId());

Any collaboration info access should be checked for null (fix verified locally):

ICollaborationInfo collaborationInfo = userMsg.getCollaborationInfo();
if (collaborationInfo != null) {
   headers.setHeader(HTTPHeaders.CONVERSATION_ID, collaborationInfo.getConversationId());
   headers.setServiceHeader(collaborationInfo.getService());
   headers.setHeader(HTTPHeaders.ACTION, collaborationInfo.getAction());
}