From a7df41d41d01de455d5549cb523e2e7714b516d6 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Wed, 4 Dec 2019 15:28:40 +0300 Subject: [PATCH] Fix debugging when script is included with additional query string --- .../information/URLDebugInformationProvider.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/teavm/debugging/information/URLDebugInformationProvider.java b/core/src/main/java/org/teavm/debugging/information/URLDebugInformationProvider.java index 8fc629507..04e480465 100644 --- a/core/src/main/java/org/teavm/debugging/information/URLDebugInformationProvider.java +++ b/core/src/main/java/org/teavm/debugging/information/URLDebugInformationProvider.java @@ -17,7 +17,8 @@ package org.teavm.debugging.information; import java.io.IOException; import java.io.InputStream; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; public class URLDebugInformationProvider implements DebugInformationProvider { private String baseURL; @@ -29,11 +30,13 @@ public class URLDebugInformationProvider implements DebugInformationProvider { @Override public DebugInformation getDebugInformation(String script) { try { - URL url = new URL(baseURL + script + ".teavmdbg"); - try (InputStream input = url.openStream()) { + URI uri = new URI(baseURL + script); + uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), + uri.getPath() + ".teavmdbg", uri.getQuery(), uri.getFragment()); + try (InputStream input = uri.toURL().openStream()) { return DebugInformation.read(input); } - } catch (IOException e) { + } catch (IOException | URISyntaxException e) { return null; } }