Fix debugging when script is included with additional query string

This commit is contained in:
Alexey Andreev 2019-12-04 15:28:40 +03:00
parent e147a998e5
commit a7df41d41d

View File

@ -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;
}
}