You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/08/02 12:43:27 UTC

[GitHub] [netbeans] oyarzun commented on a diff in pull request #3860: Multi release jar support.

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


##########
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:
   Agreed looks like "versions" is just the name of the jar in the test case.



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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