mbeckerle commented on a change in pull request #744:
URL: https://github.com/apache/daffodil/pull/744#discussion_r796910537
##########
File path:
daffodil-lib/src/main/scala/org/apache/daffodil/xml/DaffodilXMLLoader.scala
##########
@@ -215,18 +215,37 @@ class DFDLCatalogResolver private ()
val result = (resolvedId, systemId) match {
case (null, null) => {
- // This happens now in some unit tests.
- // Assert.invariantFailed("resolvedId and systemId were null.")
- Logger.log.debug(s"Unable to resolve.")
+ // This happens in numerous unit tests.
+ //
+ // It seems that in some situations the resolver is called
+ // to attempt to resolve things certain ways. Such as
+ // providing just the namespace URI, without the systemId.
+ //
+ // So the inability to resolve, in this case anyway, is not an error.
+ //
None
}
case (null, sysId) =>
{
+ // We did not get a catalog resolution of the nsURI, nor
+ // a straight file resolution of the systemId, so we
+ // use the systemId (which comes from the schemaLocation attribute)
+ // and the classpath.
val baseURI = if (baseURIString == null) None else Some(new
URI(baseURIString))
val optURI = Misc.getResourceRelativeOption(sysId, baseURI)
optURI match {
case Some(uri) => Logger.log.debug(s"Found on classpath: ${uri}.")
- case None => Logger.log.info(s"Unable to resolve ${sysId} in
${baseURI}")
+ case None => {
+ //
+ // We have to explicitly throw this, because returning with
+ // a no-resolve does not cause Xerces to report an error.
+ // Instead you just get later errors about symbols that can't
+ // be resolved, but it never mentions that an include/import
didn't
+ // work.
+ lazy val e = new SAXParseException(
+ s"""DaffodilXMLLoader: Unable to resolve
schemaLocation='$systemId'.""", null)
+ throw e
Review comment:
Will fix. This was a leftover from when I was using it in a log message,
when the lazy val prevents construting when the logging is not being performed.
--
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]