Skip to content

Commit

Permalink
Showing 10 changed files with 211 additions and 93 deletions.
10 changes: 5 additions & 5 deletions phase4-lib/src/main/java/com/helger/phase4/error/EEbmsError.java
Original file line number Diff line number Diff line change
@@ -131,19 +131,19 @@ public enum EEbmsError implements IEbmsError
private final String m_sErrorCode;
private final EEbmsErrorSeverity m_eSeverity;
private final String m_sShortDescription;
private final IHasDisplayText m_aErrorDetail;
private final IHasDisplayText m_aDescription;
private final EEbmsErrorCategory m_eCategory;

EEbmsError (@Nonnull final String sErrorCode,
@Nonnull final EEbmsErrorSeverity eSeverity,
@Nonnull final String sShortDescription,
@Nonnull final IHasDisplayText aErrorDetail,
@Nonnull final IHasDisplayText aDescription,
@Nonnull final EEbmsErrorCategory eCategory)
{
m_sErrorCode = sErrorCode;
m_eSeverity = eSeverity;
m_sShortDescription = sShortDescription;
m_aErrorDetail = aErrorDetail;
m_aDescription = aDescription;
m_eCategory = eCategory;
}

@@ -166,9 +166,9 @@ public String getShortDescription ()
}

@Nonnull
public IHasDisplayText getErrorDetail ()
public IHasDisplayText getDescription ()
{
return m_aErrorDetail;
return m_aDescription;
}

@Nonnull
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ public enum EEbmsErrorText implements IHasDisplayText
POLICY_NONCOMPLIANCE ("The processor determined that the message's security methods, parameters, scope or other security policy-level requirements or agreements were not satisfied."),
DYSFUNCTIONAL_RELIABILITY ("Some reliability function as implemented by the Reliability module, is not operational, or the reliability state associated with this message sequence is not valid."),
DELIVERY_FAILURE ("Although the message was send under Guaranteed delivery reuqirement, the Reliability module could not get assurance that the message was properly delivered, in spite of resending efforts."),
MISSING_RECEIPT ("A Receipt has not been received for a message that was previously sent by the MSH generating this error."),
MISSING_RECEIPT ("A Receipt has not been received for a message that was previously sent by the MSH generating this error."),
INVALID_RECEIPT ("A Receipt has been received for a message that was previously sent by the MSH generating this error, but the content does not match the message content (e.g. some part has not been acknowledged, or the digest associated does not match the signature digest, for NRR)."),
DECOMPRESSION_FAILURE ("An error occurred during the decompression.");

Original file line number Diff line number Diff line change
@@ -22,6 +22,8 @@
import javax.annotation.Nullable;

import com.helger.commons.builder.IBuilder;
import com.helger.commons.error.IError;
import com.helger.commons.error.level.IErrorLevel;
import com.helger.commons.string.StringHelper;
import com.helger.phase4.ebms3header.Ebms3Description;
import com.helger.phase4.ebms3header.Ebms3Error;
@@ -44,20 +46,51 @@ public class Ebms3ErrorBuilder implements IBuilder <Ebms3Error>
private EEbmsErrorSeverity m_eSeverity;
private String m_sShortDescription;

/**
* Create an empty builder.
*/
public Ebms3ErrorBuilder ()
{}

/**
* Create a new builder setting {@link #description(Ebms3Description)},
* {@link #category(EEbmsErrorCategory)}, {@link #errorCode(String)},
* {@link #severity(EEbmsErrorSeverity)} and {@link #shortDescription(String)}
*
* @param aError
* The source error. May not be <code>null</code>.
* @param aContentLocale
* The locale to be used to resolve error texts.
*/
public Ebms3ErrorBuilder (@Nonnull final IEbmsError aError, @Nonnull final Locale aContentLocale)
{
// Default to shortDescription if none provided
description (StringHelper.getNotNull (aError.getErrorDetail ().getDisplayText (aContentLocale),
description (StringHelper.getNotNull (aError.getDescription ().getDisplayText (aContentLocale),
aError.getShortDescription ()), aContentLocale);
category (aError.getCategory ());
errorCode (aError.getErrorCode ());
severity (aError.getSeverity ());
shortDescription (aError.getShortDescription ());
}

/**
* Create a new builder setting {@link #description(Ebms3Description)},
* {@link #errorCode(String)}, {@link #severity(IErrorLevel)} and
* {@link #shortDescription(String)}
*
* @param aError
* The source error. May not be <code>null</code>.
* @param aContentLocale
* The locale to be used to resolve error texts.
*/
public Ebms3ErrorBuilder (@Nonnull final IError aError, @Nonnull final Locale aContentLocale)
{
description (aError.getErrorText (aContentLocale), aContentLocale);
errorCode (aError.getErrorID ());
severity (aError.getErrorLevel ());
origin (aError.getErrorFieldName ());
}

@Nonnull
public Ebms3ErrorBuilder description (@Nullable final String s, @Nullable final Locale aLocale)
{
@@ -73,6 +106,16 @@ public Ebms3ErrorBuilder description (@Nullable final Ebms3Description a)
return this;
}

@Nonnull
public Ebms3ErrorBuilder errorDetail (@Nullable final String s, @Nullable final Exception ex)
{
return errorDetail (StringHelper.getConcatenatedOnDemand (s,
": ",
ex == null ? "" : ex.getClass ().getName () +
" - " +
ex.getMessage ()));
}

@Nonnull
public Ebms3ErrorBuilder errorDetail (@Nullable final String s)
{
@@ -108,6 +151,12 @@ public Ebms3ErrorBuilder origin (@Nullable final String s)
return this;
}

@Nonnull
public Ebms3ErrorBuilder severity (@Nullable final IErrorLevel e)
{
return severity (e == null ? null : e.isError () ? EEbmsErrorSeverity.FAILURE : EEbmsErrorSeverity.WARNING);
}

@Nonnull
public Ebms3ErrorBuilder severity (@Nullable final EEbmsErrorSeverity e)
{
@@ -131,16 +180,47 @@ public Ebms3Error build ()
throw new IllegalStateException ("Error Code is required");

final Ebms3Error aEbms3Error = new Ebms3Error ();
// Default to shortDescription if none provided

// This OPTIONAL element provides a narrative description of the error in
// the language defined by the xml:lang attribute. The content of this
// element is left to implementation-specific decisions.
aEbms3Error.setDescription (m_aDescription);

// This OPTIONAL element provides additional details about the context in
// which the error occurred. For example, it may be an exception trace.
aEbms3Error.setErrorDetail (m_sErrorDetail);

if (m_eCategory != null)
{
// This OPTIONAL attribute identifies the type of error related to a
// particular origin. For example: Content, Packaging, UnPackaging,
// Communication, InternalProcess.
aEbms3Error.setCategory (m_eCategory.getDisplayName ());
}

// This OPTIONAL attribute indicates the MessageId of the message in error,
// for which this error is raised.
aEbms3Error.setRefToMessageInError (m_sRefToMessageInError);

// This REQUIRED attribute is a unique identifier for the type of error.
aEbms3Error.setErrorCode (m_sErrorCode);

// This OPTIONAL attribute identifies the functional module within which the
// error occurred. This module could be the the ebMS Module, the Reliability
// Module, or the Security Module. Possible values for this attribute
// include "ebMS", "reliability", and "security". The use of other modules,
// and thus their corresponding @origin values, may be specified elsewhere,
// such as in a forthcoming Part 2 of this specification.
aEbms3Error.setOrigin (m_sOrigin);

// This REQUIRED attribute indicates the severity of the error. Valid values
// are: warning, failure.
aEbms3Error.setSeverity (m_eSeverity.getSeverity ());

// This OPTIONAL attribute provides a short description of the error that
// can be reported in a log, in order to facilitate readability.
aEbms3Error.setShortDescription (m_sShortDescription);

return aEbms3Error;
}
}
14 changes: 7 additions & 7 deletions phase4-lib/src/main/java/com/helger/phase4/error/EbmsError.java
Original file line number Diff line number Diff line change
@@ -36,24 +36,24 @@ public class EbmsError implements IEbmsError
private final String m_sErrorCode;
private final EEbmsErrorSeverity m_eSeverity;
private final String m_sShortDescription;
private final IHasDisplayText m_aErrorDetail;
private final IHasDisplayText m_aDescription;
private final EEbmsErrorCategory m_eCategory;

public EbmsError (@Nonnull final String sErrorCode,
@Nonnull final EEbmsErrorSeverity eSeverity,
@Nonnull final String sShortDescription,
@Nonnull final IHasDisplayText aErrorDetail,
@Nonnull final IHasDisplayText aDescription,
@Nonnull final EEbmsErrorCategory eCategory)
{
ValueEnforcer.notNull (sErrorCode, "ErrorCode");
ValueEnforcer.notNull (eSeverity, "Severity");
ValueEnforcer.notNull (sShortDescription, "ShortDescription");
ValueEnforcer.notNull (aErrorDetail, "ErrorDetail");
ValueEnforcer.notNull (aDescription, "Description");
ValueEnforcer.notNull (eCategory, "Category");
m_sErrorCode = sErrorCode;
m_eSeverity = eSeverity;
m_sShortDescription = sShortDescription;
m_aErrorDetail = aErrorDetail;
m_aDescription = aDescription;
m_eCategory = eCategory;
}

@@ -76,9 +76,9 @@ public String getShortDescription ()
}

@Nonnull
public IHasDisplayText getErrorDetail ()
public IHasDisplayText getDescription ()
{
return m_aErrorDetail;
return m_aDescription;
}

@Nonnull
@@ -93,7 +93,7 @@ public String toString ()
return new ToStringGenerator (null).append ("ErrorCode", m_sErrorCode)
.append ("Severity", m_eSeverity)
.append ("ShortDescription", m_sShortDescription)
.append ("ErrorDetail", m_aErrorDetail)
.append ("Description", m_aDescription)
.append ("Category", m_eCategory)
.getToString ();
}
27 changes: 21 additions & 6 deletions phase4-lib/src/main/java/com/helger/phase4/error/IEbmsError.java
Original file line number Diff line number Diff line change
@@ -54,18 +54,32 @@ public interface IEbmsError
/**
* Gets the value of the shortDescription property.
*
* @return possible object is {@link String }
* @return Short description. Never <code>null</code>.
*/
@Nonnull
String getShortDescription ();

/**
* Gets the value of the description property.
*
* @return The multilingual description.
* @since 2.6.0
*/
@Nonnull
IHasDisplayText getDescription ();

/**
* Gets the value of the errorDetail property.
*
* @return possible object is {@link String }
* @return The multilingual description.
* @deprecated Use {@link #getDescription()} instead
*/
@Nonnull
IHasDisplayText getErrorDetail ();
@Deprecated (forRemoval = true, since = "2.6.0")
default IHasDisplayText getErrorDetail ()
{
return getDescription ();
}

/**
* Gets the value of the category property.
@@ -108,7 +122,7 @@ default IError getAsError (@Nullable final String sAdditionalErrorText, @Nonnull
String sErrorText = "[" +
getCategory ().getDisplayName () +
"] " +
StringHelper.getNotNull (getErrorDetail ().getDisplayText (aContentLocale),
StringHelper.getNotNull (getDescription ().getDisplayText (aContentLocale),
getShortDescription ());
if (StringHelper.hasText (sAdditionalErrorText))
{
@@ -132,12 +146,13 @@ default Ebms3Error getAsEbms3Error (@Nonnull final Locale aContentLocale, @Nulla
}

@Nonnull
@Deprecated (forRemoval = true, since = "2.6.0")
default Ebms3Error getAsEbms3Error (@Nonnull final Locale aContentLocale,
@Nullable final String sRefToMessageInError,
@Nullable final String sErrorDescription)
@Nullable final String sErrorDetails)
{
return new Ebms3ErrorBuilder (this, aContentLocale).refToMessageInError (sRefToMessageInError)
.errorDetail (sErrorDescription)
.errorDetail (sErrorDetails)
.build ();
}

Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@
import com.helger.phase4.ebms3header.Ebms3SignalMessage;
import com.helger.phase4.ebms3header.Ebms3UserMessage;
import com.helger.phase4.error.EEbmsError;
import com.helger.phase4.error.Ebms3ErrorBuilder;
import com.helger.phase4.incoming.spi.IAS4IncomingMessageProcessingStatusSPI;
import com.helger.phase4.messaging.IAS4IncomingMessageMetadata;
import com.helger.phase4.messaging.domain.MessageHelperMethods;
@@ -484,17 +485,12 @@ private static void _processSoapHeaderElements (@Nonnull final SOAPHeaderElement
"; error details: " +
aErrorList);

final String sRefToMessageID = aState.getMessageID ();
final Locale aLocale = aState.getLocale ();
final String sRefToMessageID = aState.getMessageID ();
for (final IError aError : aErrorList)
{
final Ebms3Error aEbms3Error = new Ebms3Error ();
aEbms3Error.setErrorDetail (aError.getErrorText (aLocale));
aEbms3Error.setErrorCode (aError.getErrorID ());
aEbms3Error.setSeverity (aError.getErrorLevel ().getID ());
aEbms3Error.setOrigin (aError.getErrorFieldName ());
aEbms3Error.setRefToMessageInError (sRefToMessageID);
aEbmsErrorMessagesTarget.add (aEbms3Error);
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (aError, aLocale).refToMessageInError (sRefToMessageID)
.build ());
}

// Stop processing of other headers
@@ -510,9 +506,11 @@ private static void _processSoapHeaderElements (@Nonnull final SOAPHeaderElement
" with processor " +
aProcessor;
LOGGER.error (sDetails, ex);
aEbmsErrorMessagesTarget.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aState.getLocale (),
aState.getMessageID (),
sDetails));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aState.getLocale ())
.refToMessageInError (aState.getMessageID ())
.errorDetail (sDetails,
ex)
.build ());
// Stop processing of other headers
break;
}
@@ -674,9 +672,10 @@ public static IAS4MessageState processEbmsMessage (@Nonnull @WillNotClose final
LOGGER.error (sDetails);

// send EBMS:0001 error back
aEbmsErrorMessagesTarget.add (EEbmsError.EBMS_VALUE_NOT_RECOGNIZED.getAsEbms3Error (aLocale,
aState.getMessageID (),
sDetails));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_VALUE_NOT_RECOGNIZED, aLocale)
.refToMessageInError (aState.getMessageID ())
.errorDetail (sDetails)
.build ());
}

// Determine AS4 profile ID (since 0.13.0)
Original file line number Diff line number Diff line change
@@ -74,6 +74,7 @@
import com.helger.phase4.ebms3header.Ebms3SignalMessage;
import com.helger.phase4.ebms3header.Ebms3UserMessage;
import com.helger.phase4.error.EEbmsError;
import com.helger.phase4.error.Ebms3ErrorBuilder;
import com.helger.phase4.http.AS4HttpDebug;
import com.helger.phase4.http.BasicHttpPoster;
import com.helger.phase4.http.HttpMimeMessageEntity;
@@ -759,9 +760,10 @@ private void _invokeSPIsForIncoming (@Nonnull final HttpHeaderMap aHttpHeaders,
sMessageID +
"' failed: the previous processor already returned an async response URL; it is not possible to handle two URLs. Please check your SPI implementations.";
LOGGER.error (sDetails);
aEbmsErrorMessagesTarget.add (EEbmsError.EBMS_VALUE_INCONSISTENT.getAsEbms3Error (m_aLocale,
sMessageID,
sDetails));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_VALUE_INCONSISTENT, m_aLocale)
.refToMessageInError (sMessageID)
.errorDetail (sDetails)
.build ());
// Stop processing
return;
}
@@ -802,9 +804,10 @@ private void _invokeSPIsForIncoming (@Nonnull final HttpHeaderMap aHttpHeaders,
sMessageID +
"' failed: the previous processor already returned a usermessage; it is not possible to return two usermessage. Please check your SPI implementations.";
LOGGER.warn (sDetails);
aEbmsErrorMessagesTarget.add (EEbmsError.EBMS_VALUE_INCONSISTENT.getAsEbms3Error (m_aLocale,
sMessageID,
sDetails));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_VALUE_INCONSISTENT, m_aLocale)
.refToMessageInError (sMessageID)
.errorDetail (sDetails)
.build ());
// Stop processing
return;
}
@@ -821,9 +824,10 @@ private void _invokeSPIsForIncoming (@Nonnull final HttpHeaderMap aHttpHeaders,
sMessageID +
"' returned a failure: no UserMessage contained in the MPC";
LOGGER.warn (sDetails);
aEbmsErrorMessagesTarget.add (EEbmsError.EBMS_EMPTY_MESSAGE_PARTITION_CHANNEL.getAsEbms3Error (m_aLocale,
sMessageID,
sDetails));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_EMPTY_MESSAGE_PARTITION_CHANNEL,
m_aLocale).refToMessageInError (sMessageID)
.errorDetail (sDetails)
.build ());
// Stop processing
return;
}
@@ -849,12 +853,13 @@ private void _invokeSPIsForIncoming (@Nonnull final HttpHeaderMap aHttpHeaders,
{
final String sDetails = "Failed to decompress AS4 payload";
LOGGER.error (sDetails, ex);
final Locale aContentLocale = m_aLocale;
// Hack for invalid GZip content from WSS4JAttachment.getSourceStream
aEbmsErrorMessagesTarget.add (EEbmsError.EBMS_DECOMPRESSION_FAILURE.getAsEbms3Error (m_aLocale,
sMessageID,
sDetails +
": " +
ex.getMessage ()));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_DECOMPRESSION_FAILURE, aContentLocale)
.refToMessageInError (sMessageID)
.errorDetail (sDetails,
ex)
.build ());
return;
}
catch (final RuntimeException ex)
@@ -1357,7 +1362,10 @@ private IAS4ResponseFactory _handleSoapMessage (@Nonnull final HttpHeaderMap aHt
sMessageID +
"' was already handled (this is a duplicate)";
LOGGER.error (sDetails);
aEbmsErrorMessagesTarget.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (m_aLocale, sMessageID, sDetails));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, m_aLocale).refToMessageInError (
sMessageID)
.errorDetail (sDetails)
.build ());
}
else
{
Original file line number Diff line number Diff line change
@@ -72,6 +72,7 @@
import com.helger.phase4.ebms3header.Ebms3SignalMessage;
import com.helger.phase4.ebms3header.Ebms3UserMessage;
import com.helger.phase4.error.EEbmsError;
import com.helger.phase4.error.Ebms3ErrorBuilder;
import com.helger.phase4.messaging.IAS4IncomingMessageMetadata;
import com.helger.phase4.model.pmode.IPMode;
import com.helger.phase4.servlet.IAS4MessageState;
@@ -530,18 +531,20 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
{
final String sDetails = "The received Peppol message was not encrypted properly.";
LOGGER.error (sLogPrefix + sDetails);
aProcessingErrorMessages.add (EEbmsError.EBMS_FAILED_DECRYPTION.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sDetails));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_FAILED_DECRYPTION, aDisplayLocale)
.refToMessageInError (sMessageID)
.errorDetail (sDetails)
.build ());
return AS4MessageProcessorResult.createFailure ();
}
if (!aState.isSoapSignatureChecked ())
{
final String sDetails = "The received Peppol message was not signed properly.";
LOGGER.error (sLogPrefix + sDetails);
aProcessingErrorMessages.add (EEbmsError.EBMS_FAILED_AUTHENTICATION.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sDetails));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_FAILED_AUTHENTICATION, aDisplayLocale)
.refToMessageInError (sMessageID)
.errorDetail (sDetails)
.build ());
return AS4MessageProcessorResult.createFailure ();
}

@@ -574,9 +577,10 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
{
final String sDetails = "Failed to decompress the payload of attachment #" + nAttachmentIndex;
LOGGER.error (sLogPrefix + sDetails);
aProcessingErrorMessages.add (EEbmsError.EBMS_DECOMPRESSION_FAILURE.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sDetails));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_DECOMPRESSION_FAILURE, aDisplayLocale)
.refToMessageInError (sMessageID)
.errorDetail (sDetails)
.build ());
return AS4MessageProcessorResult.createFailure ();
}

@@ -595,19 +599,21 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
{
final String sDetails = "Failed to read the provided SBDH document";
LOGGER.error (sLogPrefix + sDetails);
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sDetails));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aDisplayLocale)
.refToMessageInError (sMessageID)
.errorDetail (sDetails)
.build ());
}
else
{
for (final IError aError : aSBDHErrors)
{
final String sDetails = "Peppol SBDH Issue: " + aError.getAsString (aDisplayLocale);
LOGGER.error (sLogPrefix + sDetails);
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sDetails));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aDisplayLocale)
.refToMessageInError (sMessageID)
.errorDetail (sDetails)
.build ());
}
}

@@ -639,12 +645,13 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
{
// In Peppol there must be exactly one payload
final String sDetails = "In Peppol exactly one payload attachment is expected. This request has " +
aReadAttachments.size () +
" attachments";
aReadAttachments.size () +
" attachments";
LOGGER.error (sLogPrefix + sDetails);
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sDetails));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aDisplayLocale).refToMessageInError (
aState.getMessageID ())
.errorDetail (sDetails)
.build ());
return AS4MessageProcessorResult.createFailure ();
}

@@ -675,9 +682,10 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
" - " +
ex.getMessage ();
LOGGER.error (sLogPrefix + sMsg, ex);
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sMsg));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aDisplayLocale).refToMessageInError (
aState.getMessageID ())
.errorDetail (sMsg)
.build ());
return AS4MessageProcessorResult.createFailure ();
}

@@ -713,9 +721,10 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
m_aTransportProfile.getID () +
") - not handling incoming AS4 document";
LOGGER.error (sLogPrefix + sMsg);
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sMsg));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aDisplayLocale)
.refToMessageInError (aState.getMessageID ())
.errorDetail (sMsg)
.build ());
return AS4MessageProcessorResult.createFailure ();
}

@@ -732,9 +741,10 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
" - " +
ex.getMessage ();
LOGGER.error (sLogPrefix + sMsg, ex);
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sMsg));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aDisplayLocale)
.refToMessageInError (aState.getMessageID ())
.errorDetail (sMsg)
.build ());
return AS4MessageProcessorResult.createFailure ();
}
}
@@ -773,9 +783,10 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
{
final String sMsg = "Error invoking Peppol handler " + aHandler + ": " + ex.getMessage ();
LOGGER.error (sLogPrefix + sMsg, ex);
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sMsg));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aDisplayLocale)
.refToMessageInError (aState.getMessageID ())
.errorDetail (sMsg)
.build ());

// Returned AS4 Error without a custom prefix
return AS4MessageProcessorResult.createFailure ();
@@ -790,9 +801,10 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
" - " +
ex.getMessage ();
LOGGER.error (sLogPrefix + sMsg, ex);
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aDisplayLocale,
aState.getMessageID (),
sMsg));
aProcessingErrorMessages.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aDisplayLocale)
.refToMessageInError (aState.getMessageID ())
.errorDetail (sMsg)
.build ());
return AS4MessageProcessorResult.createFailure ();
}
}
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@
import com.helger.phase4.ebms3header.Ebms3SignalMessage;
import com.helger.phase4.ebms3header.Ebms3UserMessage;
import com.helger.phase4.error.EEbmsError;
import com.helger.phase4.error.Ebms3ErrorBuilder;
import com.helger.phase4.messaging.IAS4IncomingMessageMetadata;
import com.helger.phase4.messaging.domain.MessageHelperMethods;
import com.helger.phase4.model.pmode.IPMode;
@@ -77,7 +78,7 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
@Nullable final Node aPayload,
@Nullable final ICommonsList <WSS4JAttachment> aIncomingAttachments,
@Nonnull final IAS4MessageState aState,
@Nonnull final ICommonsList <Ebms3Error> aProcessingErrorMessages)
@Nonnull final ICommonsList <Ebms3Error> aEbmsErrorMessagesTarget)
{
// Needed for AS4_TA13 because we want to force a decompression failure and
// for that to happen the stream has to be read
@@ -113,9 +114,10 @@ public AS4MessageProcessorResult processAS4UserMessage (@Nonnull final IAS4Incom
// To test returning with a failure works as intended
if (aUserMessage.getCollaborationInfo ().getAction ().equals (ACTION_FAILURE))
{
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aState.getLocale (),
aState.getMessageID (),
ACTION_FAILURE));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aState.getLocale ())
.refToMessageInError (aState.getMessageID ())
.errorDetail (ACTION_FAILURE)
.build ());
return AS4MessageProcessorResult.createFailure ();
}
return AS4MessageProcessorResult.createSuccess ();
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@
import com.helger.phase4.ebms3header.Ebms3SignalMessage;
import com.helger.phase4.ebms3header.Ebms3UserMessage;
import com.helger.phase4.error.EEbmsError;
import com.helger.phase4.error.Ebms3ErrorBuilder;
import com.helger.phase4.messaging.IAS4IncomingMessageMetadata;
import com.helger.phase4.messaging.domain.MessageHelperMethods;
import com.helger.phase4.model.EMEPBinding;
@@ -88,7 +89,7 @@ public AS4SignalMessageProcessorResult processAS4SignalMessage (@Nonnull final I
@Nonnull final Ebms3SignalMessage aSignalMessage,
@Nullable final IPMode aPMode,
@Nonnull final IAS4MessageState aState,
@Nonnull final ICommonsList <Ebms3Error> aProcessingErrorMessages)
@Nonnull final ICommonsList <Ebms3Error> aEbmsErrorMessagesTarget)
{
if (aSignalMessage.getReceipt () != null)
{
@@ -108,9 +109,10 @@ public AS4SignalMessageProcessorResult processAS4SignalMessage (@Nonnull final I
{
if (aPullRequest.getMpc ().equals (MPC_FAILURE))
{
aProcessingErrorMessages.add (EEbmsError.EBMS_OTHER.getAsEbms3Error (aState.getLocale (),
aState.getMessageID (),
"Error in creating the usermessage - mock MPC 'failure' was used!"));
aEbmsErrorMessagesTarget.add (new Ebms3ErrorBuilder (EEbmsError.EBMS_OTHER, aState.getLocale ())
.refToMessageInError (aState.getMessageID ())
.errorDetail ("Error in creating the usermessage - mock MPC 'failure' was used!")
.build ());
return AS4SignalMessageProcessorResult.createFailure ();
}

0 comments on commit fc263f2

Please sign in to comment.