diff options
author | Jouni Koivuviita <jouni@vaadin.com> | 2013-06-28 16:00:59 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-06-28 13:03:59 +0000 |
commit | a4f127722af09a0e67f8df7c9aa3916b52d4595a (patch) | |
tree | 7bedb033186c116243a54fbf104ab97cb1fe7579 /uitest/src/com/vaadin/launcher | |
parent | 419c6c787508a8b9c14a4613a96f3ac8e48b1981 (diff) | |
download | vaadin-framework-a4f127722af09a0e67f8df7c9aa3916b52d4595a.tar.gz vaadin-framework-a4f127722af09a0e67f8df7c9aa3916b52d4595a.zip |
Fixed NPE in ApplicationRunnerServlet (#12145)
If the path for a test case file contained special characters (such as
space), they would get URL encoded which wouldn't work for File
constructors.
Fixed by using URI.getPath(), which does the decoding.
Change-Id: I2a7c13b785adbb2e486d3807b115540c0ba70fa6
Diffstat (limited to 'uitest/src/com/vaadin/launcher')
-rw-r--r-- | uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 8c7edcac2e..a2f3c59f07 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -18,6 +18,8 @@ package com.vaadin.launcher; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.Collections; import java.util.LinkedHashSet; @@ -64,7 +66,13 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { String str = TestBase.class.getName().replace('.', '/') + ".class"; URL url = getService().getClassLoader().getResource(str); if ("file".equals(url.getProtocol())) { - File comVaadinTests = new File(url.getPath()).getParentFile() + String path = url.getPath(); + try { + path = new URI(path).getPath(); + } catch (URISyntaxException e) { + getLogger().log(Level.FINE, "Failed to decode url", e); + } + File comVaadinTests = new File(path).getParentFile() .getParentFile(); addDirectories(comVaadinTests, defaultPackages, "com.vaadin.tests"); |