Blob Blame History Raw
Patch by Emmanuel Bourg <ebourg@apache.org> for icedtea-web which removes pack200 support to build with OpenJDK Java 17.
See also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1011532

Patch origin: https://salsa.debian.org/java-team/icedtea-web/-/blob/master/debian/patches/remove-pack200-support.patch

--- icedtea-web-1.8.8/configure.ac							2023-05-30 02:14:16.833428945 +0200
+++ icedtea-web-1.8.8/configure.ac.java17						2023-05-30 03:26:49.139800654 +0200
@@ -129,7 +129,6 @@
 IT_FIND_JAVADOC
 IT_FIND_KEYTOOL
 IT_FIND_JARSIGNER
-IT_FIND_PACK200
 
 IT_SET_VERSION
 IT_CHECK_XULRUNNER_VERSION
@@ -152,7 +151,6 @@
   JAVA_DESKTOP=java.desktop
   JAVA_NAMING=java.naming
 fi
-IT_CHECK_FOR_CLASS(JAVA_UTIL_JAR_PACK200, [java.util.jar.Pack200], [some.pkg], [])
 IT_CHECK_FOR_CLASS(JAVA_NET_COOKIEMANAGER, [java.net.CookieManager], [some.pkg], [])
 IT_CHECK_FOR_CLASS(JAVA_NET_HTTPCOOKIE, [java.net.HttpCookie], [some.pkg], [])
 IT_CHECK_FOR_CLASS(JAVA_NET_COOKIEHANDLER, [java.net.CookieHandler], [some.pkg], [])
--- icedtea-web-1.8.8/netx/net/sourceforge/jnlp/cache/ResourceDownloader.java		2023-05-30 02:14:16.831428932 +0200
+++ icedtea-web-1.8.8/netx/net/sourceforge/jnlp/cache/ResourceDownloader.java.java17	2023-05-30 03:26:49.137800641 +0200
@@ -25,7 +25,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.jar.JarOutputStream;
-import java.util.jar.Pack200;
 import java.util.zip.GZIPInputStream;
 
 import net.sourceforge.jnlp.DownloadOptions;
@@ -151,7 +150,7 @@
         try {
             resource.setDownloadLocation(location.URL);
             URLConnection connection = ConnectionFactory.getConnectionFactory().openConnection(location.URL); // this won't change so should be okay not-synchronized
-            connection.addRequestProperty("Accept-Encoding", "pack200-gzip, gzip");
+            connection.addRequestProperty("Accept-Encoding", "gzip");
 
             File localFile = null;
             if (resource.getRequestVersion() == resource.getDownloadVersion()) {
@@ -293,7 +292,7 @@
                 URL url = urls.get(i);
                 try {
                     Map<String, String> requestProperties = new HashMap<>();
-                    requestProperties.put("Accept-Encoding", "pack200-gzip, gzip");
+                    requestProperties.put("Accept-Encoding", "gzip");
 
                     UrlRequestResult response = getUrlResponseCodeWithRedirectonResult(url, requestProperties, requestMethod);
                     if (response.result == 511) {
@@ -390,7 +389,7 @@
 
     private URLConnection getDownloadConnection(URL location) throws IOException {
         URLConnection con = ConnectionFactory.getConnectionFactory().openConnection(location);
-        con.addRequestProperty("Accept-Encoding", "pack200-gzip, gzip");
+        con.addRequestProperty("Accept-Encoding", "gzip");
         con.connect();
         return con;
     }
@@ -504,21 +503,7 @@
     }
 
     private void uncompressPackGz(URL compressedLocation, URL uncompressedLocation, Version version) throws IOException {
-        OutputController.getLogger().log(OutputController.Level.ERROR_DEBUG, "Extracting packgz: " + compressedLocation + " to " + uncompressedLocation);
-
-        try (GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(CacheUtil
-                .getCacheFile(compressedLocation, version)))) {
-            InputStream inputStream = new BufferedInputStream(gzInputStream);
-
-            JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(CacheUtil
-                    .getCacheFile(uncompressedLocation, version)));
-
-            Pack200.Unpacker unpacker = Pack200.newUnpacker();
-            unpacker.unpack(inputStream, outputStream);
-
-            outputStream.close();
-            inputStream.close();
-        }
+        throw new UnsupportedOperationException("Pack200 compression is no longer supported, cannot unpack " + compressedLocation);
     }
 
     /**