lahodaj commented on code in PR #6466:
URL: https://github.com/apache/netbeans/pull/6466#discussion_r1329917086


##########
java/java.source.base/src/org/netbeans/modules/java/source/parsing/FileObjects.java:
##########
@@ -949,6 +949,34 @@ static Pair<String,List<URL>> parseModulePatches(@NonNull 
final Iterator<? exten
         return null;
     }
 
+    public static URI getZipPathURI(URI zipURI, String resourceName) {
+        try {
+            //Optimistic try and see
+            return new URI ("jar:"+zipURI.toString()+"!/"+resourceName); 
//NOI18N
+        } catch (URISyntaxException e) {
+            //Need to encode the resName part (slower)
+            final StringBuilder sb = new StringBuilder ();
+            final String[] elements = resourceName.split("/");           
//NOI18N
+            try {
+                for (int i = 0; i< elements.length; i++) {
+                    String element = elements[i];
+                    element = URLEncoder.encode(element, "UTF-8");       
//NOI18N
+                    element = element.replace("+", "%20");               
//NOI18N

Review Comment:
   Seems space is the only character:
   
https://github.com/openjdk/jdk/blob/670b4567cf8229c9fd40c639a04dd1f1b7cfd551/src/java.base/share/classes/java/net/URLEncoder.java#L233
   
   Please note this code is merely moved from one place to another, verbatim. I 
am not really confident to change that code, unless there's a bug in it that 
needs fixing.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to