neilcsmith-net commented on code in PR #6466:
URL: https://github.com/apache/netbeans/pull/6466#discussion_r1329895785


##########
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:
   Because `URLEncoder` is not designed for encoding URLs. Are you sure that's 
the only possible problematic character?  There are libraries in NetBeans 
already that could properly encode the path if not.



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