Skip to content

Commit 0f3d722

Browse files
Update EhrExtractMapper.java
1 parent 0bcb975 commit 0f3d722

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/mapper/EhrExtractMapper.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ public String mapEhrExtractToXml(EhrExtractTemplateParameters ehrExtractTemplate
6969

7070

7171
public void validateXmlAgainstSchema(String xml) {
72-
String schemaPath = RedactionsContext.REDACTION_INTERACTION_ID.equals(redactionsContext.ehrExtractInteractionId())
72+
String interactionId = redactionsContext.ehrExtractInteractionId();
73+
boolean isRedactionInteraction = RedactionsContext.REDACTION_INTERACTION_ID.equals(interactionId);
74+
75+
String schemaPath = isRedactionInteraction
7376
? RCMR_IN030000UK07_SCHEMA_PATH
7477
: RCMR_IN030000UK06_SCHEMA_PATH;
75-
7678
try {
7779
SchemaFactory factory = SchemaFactory.newDefaultInstance();
7880
Schema schema = factory.newSchema(new File(schemaPath));
@@ -82,7 +84,7 @@ public void validateXmlAgainstSchema(String xml) {
8284

8385
LOGGER.info("XML successfully validated against schema: {}", schemaPath);
8486
} catch (SAXException | IOException e) {
85-
LOGGER.error("XML validation failed: {}", e.getMessage(), e);
87+
LOGGER.error("XML validation failed against schema {}: {}", schemaPath, e.getMessage(), e);
8688
throw new XmlSchemaValidationException("XML schema validation failed", e);
8789
}
8890
}

0 commit comments

Comments
 (0)