diff options
Diffstat (limited to 'netx/net/sourceforge')
-rw-r--r-- | netx/net/sourceforge/jnlp/cache/ResourceTracker.java | 44 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java | 2 |
2 files changed, 23 insertions, 23 deletions
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; |