olabusayoT commented on code in PR #1335:
URL: https://github.com/apache/daffodil/pull/1335#discussion_r1797214563


##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala:
##########
@@ -1459,34 +1459,27 @@ Differences were (path, expected, actual):
           )
       }
 
-    val uriIsJustPathComponent =
-      uri.getScheme == null &&
-        uri.getAuthority == null &&
-        uri.getQuery == null &&
-        uri.getFragment == null &&
-        uri.getPath != null
-
     val optResolved: Option[(URISchemaSource, Boolean)] =
-      if (uri.isAbsolute) {
-        // an absolute URI is one with a scheme. In this case, we expect to be 
able to resolve
-        // the URI and do not try anything else (e.g. filesystem, classpath). 
Since this function
+      if (uri.isAbsolute && uri.getScheme.contains("jar")) {
+        // an absolute URI is one with a scheme. In the case that it is a jar 
uri
+        // we expect to be able to resolve the URI and do not try anything else
+        // (e.g. filesystem, classpath). Since this function
         // is for schemaLocation attributes, we may eventually want to 
disallow this, and only
         // allow relative URIs (i.e. URIs without a scheme). We do have some 
places that use
         // absolute URIs in includes/imports and cannot remove this yet.
         try {
-          uri.toURL.openStream.close
+          uri.toURL.openStream.close()
           val uss = URISchemaSource(Misc.uriToDiagnosticFile(uri), uri)
           Some(uss, false)
         } catch {
           case e: IOException => None
         }
-      } else if (!uriIsJustPathComponent) {
-        // this is not an absolute URI so we don't have a scheme. This should 
just be a path, so
-        // throw an IllegalArgumentException if that's not the case
-        val msg =
-          s"Non-absolute schemaLocation URI can only contain a path component: 
$schemaLocation"
-        throw new IllegalArgumentException(msg)
-      } else if (uri.getPath.startsWith("/")) {
+      }
+      // we want to attempt to resolve the URI whether the non-jar uri has a 
scheme or not,
+      // this is relevant for when we are validating with Xerces, and it calls 
resolvesEntity
+      // we get URIs that look like file:/path/to/not/absolute/path ex: 
file:/org/apache/daffodil/xsd/dafext.xsd
+      // that fail to be found in the above case, so we have to look them up

Review Comment:
   So I looked into this a bit more, and the conversion to a URI is definitely 
coming from Xerces, though I'm not sure that's a bug. According to this link, 
the location is supposed to be a URI...so it might be a Daffodil Bug to not 
properly interprete it. Thoughts? https://www.w3.org/TR/xmlschema-1/#schema-loc



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