Mercurial > hg > release > icedtea7-2.2
changeset 1572:585bc814cee8
Merge.
author | Andrew John Hughes <gnu_andrew@member.fsf.org> |
---|---|
date | Thu, 15 Jan 2009 02:32:49 +0000 |
parents | dbdaa8e2cf1f (current diff) 3b8609a88eaf (diff) |
children | f42c98fdd7f4 |
files | ChangeLog |
diffstat | 2 files changed, 33 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Jan 15 02:31:47 2009 +0000 +++ b/ChangeLog Thu Jan 15 02:32:49 2009 +0000 @@ -16,6 +16,14 @@ * patches/icedtea-nio2.patch: Update implementation of secrets interface. +2009-01-13 Omair Majid <omajid@redhat.com> + + * rt/net/sourceforge/jnlp/cache/ResourceTracker.java + (downloadResource): Call getVersionedResourceURL to get the versioned jar. + (initializeResource): Likewise. + (getVersionedResourceURL): New function. Constructs a URL with a + version-id as the query. + 2009-01-13 Andrew John Hughes <gnu_andrew@member.fsf.org> * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaIODeleteOnExitAccess.java,
--- a/rt/net/sourceforge/jnlp/cache/ResourceTracker.java Thu Jan 15 02:31:47 2009 +0000 +++ b/rt/net/sourceforge/jnlp/cache/ResourceTracker.java Thu Jan 15 02:32:49 2009 +0000 @@ -605,7 +605,7 @@ try { // create out second in case in does not exist - URLConnection con = resource.location.openConnection(); + URLConnection con = getVersionedResourceURL(resource).openConnection(); InputStream in = new BufferedInputStream(con.getInputStream()); OutputStream out = CacheUtil.getOutputStream(resource.location, resource.downloadVersion); byte buf[] = new byte[1024]; @@ -652,7 +652,7 @@ File localFile = CacheUtil.getCacheFile(resource.location, resource.downloadVersion); // connect - URLConnection connection = resource.location.openConnection(); // this won't change so should be okay unsynchronized + URLConnection connection = getVersionedResourceURL(resource).openConnection(); // this won't change so should be okay unsynchronized int size = connection.getContentLength(); boolean current = CacheUtil.isCurrent(resource.location, resource.requestVersion, connection) && resource.getUpdatePolicy() != UpdatePolicy.FORCE; @@ -696,6 +696,29 @@ } } + + + private URL getVersionedResourceURL(Resource resource) { + String actualLocation = resource.location.getProtocol() + "://" + + resource.location.getHost(); + if (resource.location.getPort() != -1) { + actualLocation += ":" + resource.location.getPort(); + } + actualLocation += resource.location.getPath(); + if (resource.requestVersion != null + && resource.requestVersion.isVersionId()) { + actualLocation += "?version-id=" + resource.requestVersion; + } + URL versionedURL; + try { + versionedURL = new URL(actualLocation); + } catch (MalformedURLException e) { + return resource.location; + } + return versionedURL; + } + + /** * Pick the next resource to download or initialize. If there * are no more resources requested then one is taken from a