mbien commented on code in PR #3860:
URL: https://github.com/apache/netbeans/pull/3860#discussion_r935489966


##########
platform/o.n.bootstrap/src/org/netbeans/JarClassLoader.java:
##########
@@ -574,13 +609,81 @@ protected URL doGetResource(String name) throws 
IOException  {
         @Override
         protected byte[] readClass(String path) throws IOException {
             try {
+                if (isMultiRelease() && RUNTIME_VERSION > BASE_VERSION) {
+                    int[] vers = getVersions();
+                    if (vers.length > 0) {
+                        for (int i = vers.length - 1; i >= 0; i--) {
+                            int version = vers[i];
+                            if (version > RUNTIME_VERSION) {
+                                continue;
+                            }
+                            if (version < BASE_VERSION) {
+                                break;
+                            }
+                            byte[] data = archive.getData(this, 
"META-INF/versions/" + version + "/" + path);
+                            if (data != null) {
+                                return data;
+                            }
+                        }
+                    }
+                }
                 return archive.getData(this, path);
             } catch (ZipException ex) {
                 dumpFiles(file, -1);
                 throw ex;
             }
         }
-        
+
+        private int[] getVersions() {
+            int[] ret;
+            if (versions != null && (ret = versions.get()) != null) {
+                return ret;
+            }
+            try {
+                JarFile src = getJarFile("versions");

Review Comment:
   is "versions" correct here? Shouldn't this be a path within the jar (or the 
jar itself)?



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