Skip to content

Commit cb56e1b

Browse files
testforstephenadpi2
authored andcommitted
Bump version to 0.33.0 (microsoft#386)
1 parent bf9a6e4 commit cb56e1b

File tree

20 files changed

+717
-102
lines changed

20 files changed

+717
-102
lines changed

ThirdPartyNotices.txt

Lines changed: 437 additions & 0 deletions
Large diffs are not rendered by default.

com.microsoft.java.debug.core/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<attribute name="test" value="true"/>
1414
</attributes>
1515
</classpathentry>
16-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
16+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
1717
<attributes>
1818
<attribute name="maven.pomderived" value="true"/>
1919
</attributes>

com.microsoft.java.debug.core/pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>ch.epfl.scala</groupId>
66
<artifactId>com-microsoft-java-debug-core</artifactId>
7+
<packaging>jar</packaging>
78
<name>${base.name} :: Debugger Core</name>
89
<description>The Java Debug Server is an implementation of Visual Studio Code (VSCode) Debug Protocol. It can be used in Visual Studio Code to debug Java programs.</description>
910
<url>https://github.com/Microsoft/java-debug</url>
@@ -79,8 +80,8 @@
7980
<artifactId>maven-compiler-plugin</artifactId>
8081
<version>3.7.0</version>
8182
<configuration>
82-
<source>1.8</source>
83-
<target>1.8</target>
83+
<source>11</source>
84+
<target>11</target>
8485
</configuration>
8586
</plugin>
8687
<plugin>
@@ -126,7 +127,7 @@
126127
<dependency>
127128
<groupId>com.google.code.gson</groupId>
128129
<artifactId>gson</artifactId>
129-
<version>2.7</version>
130+
<version>2.8.9</version>
130131
</dependency>
131132
<dependency>
132133
<groupId>io.reactivex.rxjava2</groupId>
@@ -141,7 +142,7 @@
141142
<dependency>
142143
<groupId>commons-io</groupId>
143144
<artifactId>commons-io</artifactId>
144-
<version>2.5</version>
145+
<version>2.10.0</version>
145146
</dependency>
146147
<!-- Dependencies for test -->
147148
<dependency>

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/ProcessConsole.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void stop() {
129129
}
130130

131131
private void monitor(InputStream input, PublishSubject<String> subject) {
132-
BufferedReader reader = new BufferedReader(new InputStreamReader(input, encoding));
132+
BufferedReader reader = new BufferedReader(encoding == null ? new InputStreamReader(input) : new InputStreamReader(input, encoding));
133133
final int BUFFERSIZE = 4096;
134134
char[] buffer = new char[BUFFERSIZE];
135135
while (true) {

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/CompletionsHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
package com.microsoft.java.debug.core.adapter.handler;
1313

14-
import java.util.ArrayList;
1514
import java.util.Arrays;
15+
import java.util.Collections;
1616
import java.util.List;
1717
import java.util.concurrent.CompletableFuture;
1818

@@ -46,7 +46,7 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
4646
// completions should be illegal when frameId is zero, it is sent when the program is running, while during running we cannot resolve
4747
// the completion candidates
4848
if (completionsArgs.frameId == 0) {
49-
response.body = new ArrayList<>();
49+
response.body = new Responses.CompletionsResponseBody(Collections.emptyList());
5050
return CompletableFuture.completedFuture(response);
5151
}
5252

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/EvaluateRequestHandler.java

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017-2020 Microsoft Corporation and others.
2+
* Copyright (c) 2017-2021 Microsoft Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -14,7 +14,6 @@
1414
import java.util.Arrays;
1515
import java.util.List;
1616
import java.util.Map;
17-
import java.util.concurrent.CancellationException;
1817
import java.util.concurrent.CompletableFuture;
1918
import java.util.concurrent.CompletionException;
2019
import java.util.concurrent.ExecutionException;
@@ -106,31 +105,58 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
106105
indexedVariables = ((IntegerValue) sizeValue).value();
107106
}
108107
}
109-
} catch (CancellationException | IllegalArgumentException | InterruptedException
110-
| ExecutionException | UnsupportedOperationException e) {
111-
logger.log(Level.INFO,
112-
String.format("Failed to get the logical size for the type %s.", value.type().name()), e);
108+
} catch (Exception e) {
109+
logger.log(Level.INFO, "Failed to get the logical size of the variable", e);
113110
}
114111
}
115112
int referenceId = 0;
116113
if (indexedVariables > 0 || (indexedVariables < 0 && value instanceof ObjectReference)) {
117114
referenceId = context.getRecyclableIdPool().addObject(threadId, varProxy);
118115
}
119116

120-
String valueString = variableFormatter.valueToString(value, options);
117+
boolean hasErrors = false;
118+
String valueString = null;
119+
try {
120+
valueString = variableFormatter.valueToString(value, options);
121+
} catch (OutOfMemoryError e) {
122+
hasErrors = true;
123+
logger.log(Level.SEVERE, "Failed to convert the value of a large object to a string", e);
124+
valueString = "<Unable to display the value of a large object>";
125+
} catch (Exception e) {
126+
hasErrors = true;
127+
logger.log(Level.SEVERE, "Failed to resolve the variable value", e);
128+
valueString = "<Failed to resolve the variable value due to \"" + e.getMessage() + "\">";
129+
}
130+
121131
String detailsString = null;
122-
if (sizeValue != null) {
132+
if (hasErrors) {
133+
// If failed to resolve the variable value, skip the details info as well.
134+
} else if (sizeValue != null) {
123135
detailsString = "size=" + variableFormatter.valueToString(sizeValue, options);
124136
} else if (DebugSettings.getCurrent().showToString) {
125-
detailsString = VariableDetailUtils.formatDetailsValue(value, stackFrameReference.getThread(), variableFormatter, options, engine);
137+
try {
138+
detailsString = VariableDetailUtils.formatDetailsValue(value, stackFrameReference.getThread(), variableFormatter, options, engine);
139+
} catch (OutOfMemoryError e) {
140+
logger.log(Level.SEVERE, "Failed to compute the toString() value of a large object", e);
141+
detailsString = "<Unable to display the details of a large object>";
142+
} catch (Exception e) {
143+
logger.log(Level.SEVERE, "Failed to compute the toString() value", e);
144+
detailsString = "<Failed to resolve the variable details due to \"" + e.getMessage() + "\">";
145+
}
126146
}
127147

128148
if ("clipboard".equals(evalArguments.context) && detailsString != null) {
129149
response.body = new Responses.EvaluateResponseBody(detailsString, -1, "String", 0);
130150
} else {
151+
String typeString = "";
152+
try {
153+
typeString = variableFormatter.typeToString(value == null ? null : value.type(), options);
154+
} catch (Exception e) {
155+
logger.log(Level.SEVERE, "Failed to resolve the variable type", e);
156+
typeString = "";
157+
}
131158
response.body = new Responses.EvaluateResponseBody((detailsString == null) ? valueString : valueString + " " + detailsString,
132-
referenceId, variableFormatter.typeToString(value == null ? null : value.type(), options),
133-
Math.max(indexedVariables, 0));
159+
referenceId, typeString, Math.max(indexedVariables, 0));
134160
}
135161
return response;
136162
}

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/LaunchRequestHandler.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import java.net.MalformedURLException;
1717
import java.net.URISyntaxException;
1818
import java.nio.charset.Charset;
19-
import java.nio.charset.StandardCharsets;
2019
import java.nio.file.Path;
2120
import java.nio.file.Paths;
2221
import java.util.ArrayList;
@@ -91,23 +90,21 @@ protected CompletableFuture<Response> handleLaunchCommand(Arguments arguments, R
9190
"Failed to launch debuggee VM. Missing mainClass or modulePaths/classPaths options in launch configuration.",
9291
ErrorCode.ARGUMENT_MISSING);
9392
}
94-
if (StringUtils.isBlank(launchArguments.encoding)) {
95-
context.setDebuggeeEncoding(StandardCharsets.UTF_8);
96-
} else {
93+
if (StringUtils.isNotBlank(launchArguments.encoding)) {
9794
if (!Charset.isSupported(launchArguments.encoding)) {
9895
throw AdapterUtils.createCompletionException(
9996
"Failed to launch debuggee VM. 'encoding' options in the launch configuration is not recognized.",
10097
ErrorCode.INVALID_ENCODING);
10198
}
10299
context.setDebuggeeEncoding(Charset.forName(launchArguments.encoding));
100+
if (StringUtils.isBlank(launchArguments.vmArgs)) {
101+
launchArguments.vmArgs = String.format("-Dfile.encoding=%s", context.getDebuggeeEncoding().name());
102+
} else {
103+
// if vmArgs already has the file.encoding settings, duplicate options for jvm will not cause an error, the right most value wins
104+
launchArguments.vmArgs = String.format("%s -Dfile.encoding=%s", launchArguments.vmArgs, context.getDebuggeeEncoding().name());
105+
}
103106
}
104107

105-
if (StringUtils.isBlank(launchArguments.vmArgs)) {
106-
launchArguments.vmArgs = String.format("-Dfile.encoding=%s", context.getDebuggeeEncoding().name());
107-
} else {
108-
// if vmArgs already has the file.encoding settings, duplicate options for jvm will not cause an error, the right most value wins
109-
launchArguments.vmArgs = String.format("%s -Dfile.encoding=%s", launchArguments.vmArgs, context.getDebuggeeEncoding().name());
110-
}
111108
context.setLaunchMode(launchArguments.noDebug ? LaunchMode.NO_DEBUG : LaunchMode.DEBUG);
112109

113110
activeLaunchHandler.preLaunch(launchArguments, context);

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/LaunchUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public static synchronized Path generateClasspathJar(String[] classPaths) throws
7373
public static synchronized Path generateArgfile(String[] classPaths, String[] modulePaths) throws IOException {
7474
String argfile = "";
7575
if (ArrayUtils.isNotEmpty(classPaths)) {
76-
argfile = "-classpath \"" + String.join(File.pathSeparator, classPaths) + "\"";
76+
argfile = "-cp \"" + String.join(File.pathSeparator, classPaths) + "\"";
7777
}
7878

7979
if (ArrayUtils.isNotEmpty(modulePaths)) {
80-
argfile = " --module-path \"" + String.join(File.pathSeparator, modulePaths) + "\"";
80+
argfile += " --module-path \"" + String.join(File.pathSeparator, modulePaths) + "\"";
8181
}
8282

8383
argfile = argfile.replace("\\", "\\\\");

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StepRequestHandler.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,22 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
145145
private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession, IDebugAdapterContext context,
146146
ThreadState threadState) {
147147
Event event = debugEvent.event;
148+
EventRequestManager eventRequestManager = debugSession.getVM().eventRequestManager();
148149

149150
// When a breakpoint occurs, abort any pending step requests from the same thread.
150151
if (event instanceof BreakpointEvent || event instanceof ExceptionEvent) {
151152
long threadId = ((LocatableEvent) event).thread().uniqueID();
152153
if (threadId == threadState.threadId && threadState.pendingStepRequest != null) {
153-
threadState.deleteStepRequests(debugSession.getVM().eventRequestManager());
154+
threadState.deleteStepRequest(eventRequestManager);
155+
threadState.deleteMethodExitRequest(eventRequestManager);
154156
context.getStepResultManager().removeMethodResult(threadId);
155157
if (threadState.eventSubscription != null) {
156158
threadState.eventSubscription.dispose();
157159
}
158160
}
159161
} else if (event instanceof StepEvent) {
160162
ThreadReference thread = ((StepEvent) event).thread();
161-
threadState.deleteStepRequests(debugSession.getVM().eventRequestManager());
163+
threadState.deleteStepRequest(eventRequestManager);
162164
if (isStepFiltersConfigured(context.getStepFilters())) {
163165
try {
164166
if (threadState.pendingStepType == Command.STEPIN) {
@@ -181,6 +183,7 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession,
181183
// ignore.
182184
}
183185
}
186+
threadState.deleteMethodExitRequest(eventRequestManager);
184187
if (threadState.eventSubscription != null) {
185188
threadState.eventSubscription.dispose();
186189
}
@@ -280,10 +283,13 @@ class ThreadState {
280283
Location stepLocation = null;
281284
Disposable eventSubscription = null;
282285

283-
public void deleteStepRequests(EventRequestManager manager) {
284-
DebugUtility.deleteEventRequestSafely(manager, this.pendingStepRequest);
286+
public void deleteMethodExitRequest(EventRequestManager manager) {
285287
DebugUtility.deleteEventRequestSafely(manager, this.pendingMethodExitRequest);
286288
this.pendingMethodExitRequest = null;
289+
}
290+
291+
public void deleteStepRequest(EventRequestManager manager) {
292+
DebugUtility.deleteEventRequestSafely(manager, this.pendingStepRequest);
287293
this.pendingStepRequest = null;
288294
}
289295
}

0 commit comments

Comments
 (0)