aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net
diff options
context:
space:
mode:
authorDenis Lila <[email protected]>2011-03-04 17:36:23 -0500
committerDenis Lila <[email protected]>2011-03-04 17:36:23 -0500
commit43cf2ac30fcb4d562d8fbed3ea87743107e8bf92 (patch)
tree93e9dd5dcf951deb638af35840e56949bc152a46 /netx/net
parenteb116d00b1dfee2df7b1dc6191d388a4b0f4b846 (diff)
Fixed packed jar naming and pack.gz decompression problem.
Diffstat (limited to 'netx/net')
-rw-r--r--netx/net/sourceforge/jnlp/cache/ResourceTracker.java44
-rw-r--r--netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java2
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;