Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

package com.microsoft.java.debug.core.adapter;

import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.Files;
Expand Down Expand Up @@ -220,4 +222,18 @@ public static String getSHA256HexDigest(String content) {
}
return buf.toString();
}

/**
* Decode the uri string.
* @param uri
* the uri string
* @return the decoded uri
*/
public static String decodeURIComponent(String uri) {
try {
return URLDecoder.decode(uri, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
return uri;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public void handle(Command command, Arguments arguments, Response response, IDeb
try {
List<Types.Breakpoint> res = new ArrayList<>();
IBreakpoint[] toAdds = this.convertClientBreakpointsToDebugger(sourcePath, bpArguments.breakpoints, context);
IBreakpoint[] added = manager.setBreakpoints(sourcePath, toAdds, bpArguments.sourceModified);
// See the VSCode bug https://github.com/Microsoft/vscode/issues/36471.
// The source uri sometimes is encoded by VSCode, the debugger will decode it to keep the uri consistent.
IBreakpoint[] added = manager.setBreakpoints(AdapterUtils.decodeURIComponent(sourcePath), toAdds, bpArguments.sourceModified);
for (int i = 0; i < bpArguments.breakpoints.length; i++) {
// For newly added breakpoint, should install it to debuggee first.
if (toAdds[i] == added[i] && added[i].className() != null) {
Expand Down