stevedlawrence commented on code in PR #1451:
URL: https://github.com/apache/daffodil/pull/1451#discussion_r1985444023


##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Misc.scala:
##########
@@ -216,6 +218,18 @@ object Misc {
     }
   }
 
+  def optResourceURI(contextURI: URI, relPath: String): Option[URI] = {
+    val relURI = contextURI.resolve(relPath)

Review Comment:
   I know this was just copied from getResourceRelativeOnlyOption, but we 
should rename relURI to resolvedURI here also. relURI really isn't a good 
description of what this variable represents.



##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/exceptions/SchemaFileLocatable.scala:
##########
@@ -125,7 +125,21 @@ 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,
+    ({
+      val sysId = xercesError.getSystemId
+      val diagnosticFile = schemaFileLocation.diagnosticFile
+      if (sysId == null) {
+        schemaFileLocation.diagnosticFile
+      } else {
+        val sysIdFile = new File(sysId)
+        val sysIdNormalizedPath = sysIdFile.getPath
+        // Return the diagnostic file if the ends of the paths match, 
otherwise return the new File
+        if (sysIdNormalizedPath.endsWith(diagnosticFile.getPath))
+          diagnosticFile
+        else
+          new File(sysIdNormalizedPath)
+      }
+    }),

Review Comment:
   Can this change be reverted? Now that failures to load the validation schema 
result in an assertion, I think XercesSchemaFileLocation will only be created 
where schemaFileLocation.diagnosticFile is correct.



-- 
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]

Reply via email to