stevedlawrence commented on code in PR #1451:
URL: https://github.com/apache/daffodil/pull/1451#discussion_r1983941190
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/exceptions/SchemaFileLocatable.scala:
##########
@@ -125,7 +125,12 @@ class XercesSchemaFileLocation(
) extends SchemaFileLocation(
(if (xercesError.getLineNumber > 0)
Some(xercesError.getLineNumber.toString) else None),
(if (xercesError.getColumnNumber > 0)
Some(xercesError.getColumnNumber.toString) else None),
- schemaFileLocation.diagnosticFile,
+ (if (
+ xercesError.getSystemId != null &&
+ // only set to systemId if it's different from the diagnosticFile path
+
!xercesError.getSystemId.endsWith(schemaFileLocation.diagnosticFile.getPath)
+ ) new File(xercesError.getSystemId)
+ else schemaFileLocation.diagnosticFile),
Review Comment:
Interesting. So it looks like like this is an error trying to load the
XMLSchema_for_DFDL.xsd schema used to validate HelloWorld.dfdl.xsd, due to some
weirdness with GraalVM I guess?
But loading that schema should really never fail. If that fails, it
indicates a bug in Daffodil (like not correctly supporting resource URIS). So
that message probably shouldn't be converted to an SDE at all and instead
probably wants to something like an `Assert.invariantFailed`.
I wonder if `XercesValidator.fromURI(...)` will throw an exception if it
fails to create a validator?
https://github.com/apache/daffodil/blob/main/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/DaffodilXMLLoader.scala#L737
If so, maybe we can just wrap that in a try/catch and throw the assertion?
That way this change wouldn't be needed since XercesSchemaFileLocation should
only ever be used when the DFDL schema fails to validate, in which case it
should have the correct location?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]