diff --git a/README.md b/README.md index 44800a0b..e75c4cd2 100644 --- a/README.md +++ b/README.md @@ -270,6 +270,8 @@ Once you have deployed the `war` file, there are several **checks to ensure that # News and Noteworthy +* v0.3.4 - 2023-01-10 + * Updated to DCNG 0.2.12 fixing the value of `DcngIdentifierFactory.DOCTYPE_SCHEME_CANONICAL_EVENT_CATALOGUE` (`Type` was missing) * v0.3.3 - 2022-12-21 * Fixed an error in determining the `EMessageServiceType` if the source element used an explicit namespace prefix * v0.3.2 - 2022-12-15 diff --git a/de4a-connector/src/main/java/eu/de4a/connector/api/controller/ConnectorController.java b/de4a-connector/src/main/java/eu/de4a/connector/api/controller/ConnectorController.java index 01eb8ca1..8c76c496 100644 --- a/de4a-connector/src/main/java/eu/de4a/connector/api/controller/ConnectorController.java +++ b/de4a-connector/src/main/java/eu/de4a/connector/api/controller/ConnectorController.java @@ -69,11 +69,13 @@ private static T _conversionBytesWithCatching (final InputStream obj, final DE4AMarshaller marshaller, final ConnectorException ex) { - final ConnectorException baseEx = ex.withFamily (EFamilyErrorType.CONVERSION_ERROR).withLayer (ELayerError.INTERNAL_FAILURE); + ex.withFamily (EFamilyErrorType.CONVERSION_ERROR).withLayer (ELayerError.INTERNAL_FAILURE); marshaller.readExceptionCallbacks ().set (e -> { if (e.getLinkedException () != null) - baseEx.withMessageArg (e.getLinkedException ().getMessage ()); - KafkaClientWrapper.sendError (EFamilyErrorType.CONVERSION_ERROR, ex.getModule (), e.getLinkedException ().getMessage ()); + ex.withMessageArg (e.getLinkedException ().getMessage ()); + KafkaClientWrapper.sendError (EFamilyErrorType.CONVERSION_ERROR, + ex.getModule (), + e.getLinkedException ().getMessage ()); }); final T returnObj; @@ -83,19 +85,19 @@ private static T _conversionBytesWithCatching (final InputStream obj, } catch (final Exception e) { - if (LOGGER.isDebugEnabled ()) - LOGGER.debug ("Object received is not valid, check the structure", e); - throw baseEx.withMessageArg (e.getMessage ()); + LOGGER.error ("Object received is not valid, check the structure", e); + throw ex.withMessageArg (e.getMessage ()); } if (returnObj == null) - throw baseEx.withMessageArg (ex.getArgs ()); + { + LOGGER.error ("Object received is not valid but no Exception was thrown"); + throw ex.withMessageArg (ex.getArgs ()); + } return returnObj; } - @PostMapping (value = "/requestTransferEvidenceIM", - produces = MediaType.APPLICATION_XML_VALUE, - consumes = MediaType.APPLICATION_XML_VALUE) + @PostMapping (value = "/requestTransferEvidenceIM", produces = MediaType.APPLICATION_XML_VALUE, consumes = MediaType.APPLICATION_XML_VALUE) public ResponseEntity iteration1LegacyIM (@Valid final InputStream request) { // Read the old format @@ -119,7 +121,9 @@ private static T _conversionBytesWithCatching (final InputStream obj, aNewRequest.getRequestEvidenceIMItemAtIndex (0).addAdditionalParameter (addParam); } - final IDocumentTypeIdentifier aNewDocTypeID = DcngConfig.getIdentifierFactory ().parseDocumentTypeIdentifier (aNewRequest.getRequestEvidenceIMItemAtIndex (0).getCanonicalEvidenceTypeId ()); + final IDocumentTypeIdentifier aNewDocTypeID = DcngConfig.getIdentifierFactory () + .parseDocumentTypeIdentifier (aNewRequest.getRequestEvidenceIMItemAtIndex (0) + .getCanonicalEvidenceTypeId ()); final AS4MessageDTO messageDTO = new AS4MessageDTO (aNewRequest.getDataEvaluator ().getAgentUrn (), aNewRequest.getDataOwner ().getAgentUrn (), aNewDocTypeID, @@ -158,7 +162,9 @@ private static T _conversionBytesWithCatching (final InputStream obj, if (aResponseDoc == null) { // Failed to wait - send error message back - final String sErrorMsg = "Failed to wait for synchronous response on legacy IM request. Timeout after " + timeout + " milliseconds."; + final String sErrorMsg = "Failed to wait for synchronous response on legacy IM request. Timeout after " + + timeout + + " milliseconds."; LOGGER.error (sErrorMsg); // Copy as much as possible from the old request aOldResponse = DE4AResponseDocumentHelper.createResponseTransferEvidence (aOldRequest); @@ -174,7 +180,8 @@ private static T _conversionBytesWithCatching (final InputStream obj, if (aNewResponse == null) { LOGGER.warn ("Response received:\n" + - XMLWriter.getNodeAsString (aResponseDoc, new XMLWriterSettings ().setIndent (EXMLSerializeIndent.INDENT_AND_ALIGN))); + XMLWriter.getNodeAsString (aResponseDoc, + new XMLWriterSettings ().setIndent (EXMLSerializeIndent.INDENT_AND_ALIGN))); throw new IllegalStateException ("Failed to interprete Response as ResponseExtractMultiEvidenceType - see log for details"); } diff --git a/de4a-connector/src/main/java/eu/de4a/connector/api/manager/MessageExchangeManager.java b/de4a-connector/src/main/java/eu/de4a/connector/api/manager/MessageExchangeManager.java index 523cec49..a2f46782 100644 --- a/de4a-connector/src/main/java/eu/de4a/connector/api/manager/MessageExchangeManager.java +++ b/de4a-connector/src/main/java/eu/de4a/connector/api/manager/MessageExchangeManager.java @@ -292,6 +292,7 @@ public void processMessageExchange (@Nonnull final MessageExchangeWrapper messag if (StringHelper.hasText (sIteration1RememberID)) { // This only affects the backwards compatibility layer + // It deals with the synchronous response of sending the legacy IM request final var aOldResponseMarshaller = DE4AMarshaller.doImResponseMarshaller (IDE4ACanonicalEvidenceType.NONE); final ResponseExtractEvidenceType aOldResponse = aOldResponseMarshaller.read (response.getBody ()); final ResponseExtractMultiEvidenceType aNewResponse = LegacyAPIHelper.convertOldToNewResponse (aOldResponse, diff --git a/pom.xml b/pom.xml index be706353..772667d0 100644 --- a/pom.xml +++ b/pom.xml @@ -98,7 +98,7 @@ com.helger.phase4 phase4-parent-pom - 1.4.1 + 1.4.2 pom import @@ -179,7 +179,7 @@ com.helger.dcng dcng-parent-pom - 0.2.11 + 0.2.12 pom import