Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support resolving stacktrace to uri #1584

Merged
merged 3 commits into from
Nov 3, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Make projectNames optional
Signed-off-by: Sheng Chen <[email protected]>
jdneo committed Nov 2, 2020
commit 278e1bd82fb39a6e9c0c18b2df21af3ed5a79d3c
Original file line number Diff line number Diff line change
@@ -81,7 +81,11 @@ public Object executeCommand(String commandId, List<Object> arguments, IProgress
ProjectCommand.importProject(monitor);
return null;
case "java.project.resolveSourceUri":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the input is the stacktrace text, the command name such as java.project.resolveStackTraceLocation is more descriptive.

return ResolveSourceMappingHandler.resolveSourceUri((String) arguments.get(0), (ArrayList<String>) arguments.get(1));
List<String> projectNames = null;
if (arguments.size() > 1) {
projectNames = (ArrayList<String>) arguments.get(1);
}
return ResolveSourceMappingHandler.resolveSourceUri((String) arguments.get(0), projectNames);
default:
break;
}
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@

package org.eclipse.jdt.ls.core.internal.handlers;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;
@@ -40,4 +39,11 @@ public void testResolveDependencyUri() {
assertTrue(uri.startsWith("jdt://contents/junit-4.13.jar/org.junit/Assert.class"));
assertTrue(uri.contains("junit%5C/junit%5C/4.13%5C/junit-4.13.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/test=/true=/=/maven.groupId=/junit=/=/maven.artifactId=/junit=/=/maven.version=/4.13=/=/maven.scope=/test=/%3Corg.junit(Assert.class"));
}

@Test
public void testResolveDependencyUriWithoutGivingProjectNames() {
String uri = ResolveSourceMappingHandler.resolveSourceUri("at org.junit.Assert.assertEquals(Assert.java:117)", null);
assertTrue(uri.startsWith("jdt://contents/junit-4.13.jar/org.junit/Assert.class"));
assertTrue(uri.contains("junit%5C/junit%5C/4.13%5C/junit-4.13.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/test=/true=/=/maven.groupId=/junit=/=/maven.artifactId=/junit=/=/maven.version=/4.13=/=/maven.scope=/test=/%3Corg.junit(Assert.class"));
}
}