exporting patch:
# HG changeset patch
# User Denis Lila <dlila@redhat.com>
# Date 1299278183 18000
# Node ID 669de8a29c6e27d81b465743ae8d4cd1afcd6f47
# Parent  64b9d3a8239cc4521971c7a867f05ae92501bb70
Fixed packed jar naming and pack.gz decompression problem.

diff -r 64b9d3a8239c -r 669de8a29c6e ChangeLog
--- a/ChangeLog	Thu Mar 03 17:56:00 2011 -0500
+++ b/ChangeLog	Fri Mar 04 17:36:23 2011 -0500
@@ -1,3 +1,12 @@
+2011-03-04  Denis Lila  <dlila@redhat.com>
+
+	* netx/net/sourceforge/jnlp/cache/ResourceTracker.java
+	(downloadResource): changed the order in which pack200+gz compression
+	and gzip compression are checked.
+	* netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java
+	(getUrl): if usePack now concatenating strings instead of replacing.
+
+
 2011-03-03  Deepak Bhole <dbhole@redhat.com>
 
 	* plugin/icedteanp/IcedTeaNPPlugin.cc
diff -r 64b9d3a8239c -r 669de8a29c6e netx/net/sourceforge/jnlp/cache/ResourceTracker.java
--- a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java	Thu Mar 03 17:56:00 2011 -0500
+++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java	Fri Mar 04 17:36:23 2011 -0500
@@ -653,11 +653,14 @@
 
             }
 
-            if ("gzip".equals(contentEncoding)) {
+            boolean packgz = "pack200-gzip".equals(contentEncoding) ||
+                                realLocation.getPath().endsWith(".pack.gz");
+            boolean gzip = "gzip".equals(contentEncoding);
+            
+            if (packgz) {
+                downloadLocation = new URL(downloadLocation.toString() + ".pack.gz");
+            } else if (gzip) {
                 downloadLocation = new URL(downloadLocation.toString() + ".gz");
-            } else if ("pack200-gzip".equals(contentEncoding) ||
-                    realLocation.getPath().endsWith(".pack.gz")) {
-                downloadLocation = new URL(downloadLocation.toString() + ".pack.gz");
             }
 
             InputStream in = new BufferedInputStream(con.getInputStream());
@@ -681,7 +684,21 @@
              * If the file was compressed, uncompress it.
              */
 
-            if ("gzip".equals(contentEncoding)) {
+            if (packgz) {
+                GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(
+                        CacheUtil.getCacheFile(downloadLocation, resource.downloadVersion)));
+                InputStream inputStream = new BufferedInputStream(gzInputStream);
+
+                JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(
+                        CacheUtil.getCacheFile(resource.location, resource.downloadVersion)));
+
+                Unpacker unpacker = Pack200.newUnpacker();
+                unpacker.unpack(inputStream, outputStream);
+
+                outputStream.close();
+                inputStream.close();
+                gzInputStream.close();
+            } else if (gzip) {
                 GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(CacheUtil
                         .getCacheFile(downloadLocation, resource.downloadVersion)));
                 InputStream inputStream = new BufferedInputStream(gzInputStream);
@@ -697,25 +714,8 @@
                 outputStream.close();
                 inputStream.close();
                 gzInputStream.close();
-
-            } else if ("pack200-gzip".equals(contentEncoding) ||
-                    realLocation.getPath().endsWith(".pack.gz")) {
-                GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(
-                        CacheUtil.getCacheFile(downloadLocation, resource.downloadVersion)));
-                InputStream inputStream = new BufferedInputStream(gzInputStream);
-
-                JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(
-                        CacheUtil.getCacheFile(resource.location, resource.downloadVersion)));
-
-                Unpacker unpacker = Pack200.newUnpacker();
-                unpacker.unpack(inputStream, outputStream);
-
-                outputStream.close();
-                inputStream.close();
-                gzInputStream.close();
             }
 
-
             resource.changeStatus(DOWNLOADING, DOWNLOADED);
             synchronized (lock) {
                 lock.notifyAll(); // wake up wait's to check for completion
diff -r 64b9d3a8239c -r 669de8a29c6e netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java
--- a/netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java	Thu Mar 03 17:56:00 2011 -0500
+++ b/netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java	Fri Mar 04 17:36:23 2011 -0500
@@ -122,7 +122,7 @@
             filename = name + "__V" + resource.requestVersion + "." + extension;
         }
         if (usePack) {
-            filename = filename.replace(".jar", ".pack.gz");
+            filename = filename + ".pack.gz";
         }
 
         location = location.substring(0, lastSlash + 1) + filename;