diff options
author | Denis Lila <[email protected]> | 2011-03-04 17:36:23 -0500 |
---|---|---|
committer | Denis Lila <[email protected]> | 2011-03-04 17:36:23 -0500 |
commit | 43cf2ac30fcb4d562d8fbed3ea87743107e8bf92 (patch) | |
tree | 93e9dd5dcf951deb638af35840e56949bc152a46 | |
parent | eb116d00b1dfee2df7b1dc6191d388a4b0f4b846 (diff) |
Fixed packed jar naming and pack.gz decompression problem.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/cache/ResourceTracker.java | 44 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java | 2 |
3 files changed, 32 insertions, 23 deletions
@@ -1,3 +1,12 @@ +2011-03-04 Denis Lila <[email protected]> + + * 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 <[email protected]> * plugin/icedteanp/IcedTeaNPPlugin.cc diff --git a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java index 93e763e..9e033cf 100644 --- a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java +++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java @@ -653,11 +653,14 @@ public class ResourceTracker { } - if ("gzip".equals(contentEncoding)) { - downloadLocation = new URL(downloadLocation.toString() + ".gz"); - } else if ("pack200-gzip".equals(contentEncoding) || - realLocation.getPath().endsWith(".pack.gz")) { + 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"); } InputStream in = new BufferedInputStream(con.getInputStream()); @@ -681,7 +684,21 @@ public class ResourceTracker { * 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 @@ public class ResourceTracker { 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 --git a/netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java b/netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java index be9844a..ad9a540 100644 --- a/netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java +++ b/netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java @@ -122,7 +122,7 @@ public class ResourceUrlCreator { 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; |