/hg/release/icedtea-web-1.6: Improved caching of files obtained ...
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Wed May 27 14:57:22 UTC 2015
changeset 9d92f5640f83 in /hg/release/icedtea-web-1.6
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.6?cmd=changeset;node=9d92f5640f83
author: Jiri Vanek <jvanek at redhat.com>
date: Wed May 27 16:56:55 2015 +0200
Improved caching of files obtained via query
diffstat:
ChangeLog | 10 +++++
netx/net/sourceforge/jnlp/cache/CacheUtil.java | 3 +
tests/netx/unit/net/sourceforge/jnlp/cache/CacheUtilTest.java | 19 +++++++++-
tests/netx/unit/net/sourceforge/jnlp/cache/ResourceDownloaderTest.java | 1 -
4 files changed, 31 insertions(+), 2 deletions(-)
diffs (70 lines):
diff -r 6e7d203b9374 -r 9d92f5640f83 ChangeLog
--- a/ChangeLog Fri May 22 19:34:22 2015 +0200
+++ b/ChangeLog Wed May 27 16:56:55 2015 +0200
@@ -1,3 +1,13 @@
+2015-05-27 Jiri Vanek <jvanek at redhat.com>
+
+ Improved caching of files obtained via query
+ * netx/net/sourceforge/jnlp/cache/CacheUtil.java: now consider also query(if any)
+ when creating file-name for item to be cached
+ * tests/netx/unit/net/sourceforge/jnlp/cache/CacheUtilTest.java: fixed old
+ tests due to change and added two new tests to test change.
+ * tests/netx/unit/net/sourceforge/jnlp/cache/ResourceDownloaderTest.java:
+ removed unused import.
+
2015-05-22 Jiri Vanek <jvanek at redhat.com>
Comments in deployment.properties now persists saving via itweb-settings
diff -r 6e7d203b9374 -r 9d92f5640f83 netx/net/sourceforge/jnlp/cache/CacheUtil.java
--- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java Fri May 22 19:34:22 2015 +0200
+++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java Wed May 27 16:56:55 2015 +0200
@@ -481,6 +481,9 @@
path.append(location.getHost());
path.append(File.separatorChar);
path.append(location.getPath().replace('/', File.separatorChar));
+ if (location.getQuery() != null && !location.getQuery().trim().isEmpty()) {
+ path.append(".").append(location.getQuery());
+ }
return new File(FileUtils.sanitizePath(path.toString()));
}
diff -r 6e7d203b9374 -r 9d92f5640f83 tests/netx/unit/net/sourceforge/jnlp/cache/CacheUtilTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/cache/CacheUtilTest.java Fri May 22 19:34:22 2015 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/cache/CacheUtilTest.java Wed May 27 16:56:55 2015 +0200
@@ -58,7 +58,24 @@
@Test
public void testUrlToPath() throws Exception {
final URL u = new URL("https://example.com/applet/some:weird*applet?.jar");
- final File expected = new File("/tmp/https/example.com/applet/some_weird_applet");
+ //stuf behind querry is kept
+ final File expected = new File("/tmp/https/example.com/applet/some_weird_applet..jar");
+ Assert.assertEquals(expected, CacheUtil.urlToPath(u, "/tmp"));
+ }
+
+
+ @Test
+ public void testUrlToPathWithQuery() throws Exception {
+ final URL u = new URL("https://example.com/applet/applet.php?id=applet5");
+ //querry is kept and sanitized
+ final File expected = new File("/tmp/https/example.com/applet/applet.php.id_applet5");
+ Assert.assertEquals(expected, CacheUtil.urlToPath(u, "/tmp"));
+ }
+ @Test
+ public void testUrlToPathWithoutQuery() throws Exception {
+ final URL u = new URL("https://example.com/applet/applet.php");
+ //no doubledot is caused by patch adding query to file
+ final File expected = new File("/tmp/https/example.com/applet/applet.php");
Assert.assertEquals(expected, CacheUtil.urlToPath(u, "/tmp"));
}
}
diff -r 6e7d203b9374 -r 9d92f5640f83 tests/netx/unit/net/sourceforge/jnlp/cache/ResourceDownloaderTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceDownloaderTest.java Fri May 22 19:34:22 2015 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceDownloaderTest.java Wed May 27 16:56:55 2015 +0200
@@ -29,7 +29,6 @@
import net.sourceforge.jnlp.ServerAccess;
import net.sourceforge.jnlp.ServerLauncher;
import net.sourceforge.jnlp.Version;
-import net.sourceforge.jnlp.config.DeploymentConfiguration;
import net.sourceforge.jnlp.config.PathsAndFiles;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.jnlp.util.JarFile;
More information about the distro-pkg-dev
mailing list