NIFI-13709 Added more meaningful message when validation fails with non-compliant XML is validated and no schema is provided.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #9229.
This commit is contained in:
dan-s1 2024-09-04 17:23:04 +00:00 committed by Pierre Villard
parent 5f0cbed5a6
commit 727b0ba106
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
2 changed files with 5 additions and 1 deletions

View File

@ -217,7 +217,7 @@ public class ValidateXml extends AbstractProcessor {
reader.next();
}
} catch (final XMLStreamException e) {
throw new ProcessingException("Reading stream failed", e);
throw new ProcessingException("Reading stream failed: " + e.getMessage(), e);
}
} else {
final XMLStreamReaderProvider readerProvider = new StandardXMLStreamReaderProvider();

View File

@ -168,6 +168,8 @@ public class TestValidateXml {
runner.assertAllFlowFilesTransferred(ValidateXml.REL_INVALID, 1);
runner.assertAllFlowFilesContainAttribute(ValidateXml.REL_INVALID, ValidateXml.ERROR_ATTRIBUTE_KEY);
String errorAttribute = runner.getFlowFilesForRelationship(ValidateXml.REL_INVALID).get(0).getAttribute(ValidateXml.ERROR_ATTRIBUTE_KEY);
assertTrue(errorAttribute.contains("ParseError"));
}
@Test
@ -191,5 +193,7 @@ public class TestValidateXml {
runner.assertAllFlowFilesTransferred(ValidateXml.REL_INVALID, 1);
runner.assertAllFlowFilesContainAttribute(ValidateXml.REL_INVALID, ValidateXml.ERROR_ATTRIBUTE_KEY);
String errorAttribute = runner.getFlowFilesForRelationship(ValidateXml.REL_INVALID).get(0).getAttribute(ValidateXml.ERROR_ATTRIBUTE_KEY);
assertTrue(errorAttribute.contains("ParseError"));
}
}