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


##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Misc.scala:
##########
@@ -159,6 +159,25 @@ object Misc {
     }
   }
 
+  /**
+   * Split a jar URI into its two component parts: 1) the path to a jar file 
2) the resource
+   * path within that jar file. By definition, these two parts are delimited 
by the last
+   * occurrence of an exclamation point. If the resource path part contains an 
exclamation point
+   * it should have already been escaped using %21.

Review Comment:
   I updated the comment to make this more clear. 
   
   I think maybe one reason why this isn't part of something like apache 
commons is that it really isn't standard. Nested jars is not something 
supported by java and the "jar" URI natively. Instead, things like Spring Boot 
add that support. And because we kindof mess with jar URIs (which may not be 
standard Java jar URIs) we start running into problems like this.
   
   Really, there should be a standard API for resolving a path relative to a 
jar URI. The URI class does have the `resolve` method, but that doesn't seem to 
work like you would expect for jar URIs. But if that did work, then however 
Spring Boot adds support for nested jars, it could probably also add support 
for resolving relative paths in nested jars.
   
   So all this code we have should just be `uri.resolve(relativePath)` and it 
would just work. But unfortunately that's doesn't seem to be the case. Or we're 
using the URI class completely wrong...



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