Skip to content

Commit 9d88e12

Browse files
committed
Revert "Bump version to 0.33.0 (microsoft#386)"
This reverts commit cb56e1b.
1 parent cb56e1b commit 9d88e12

File tree

20 files changed

+102
-717
lines changed

20 files changed

+102
-717
lines changed

ThirdPartyNotices.txt

Lines changed: 0 additions & 437 deletions
This file was deleted.

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-11">
16+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
1717
<attributes>
1818
<attribute name="maven.pomderived" value="true"/>
1919
</attributes>

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>ch.epfl.scala</groupId>
66
<artifactId>com-microsoft-java-debug-core</artifactId>
7-
<packaging>jar</packaging>
87
<name>${base.name} :: Debugger Core</name>
98
<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>
109
<url>https://github.com/Microsoft/java-debug</url>
@@ -80,8 +79,8 @@
8079
<artifactId>maven-compiler-plugin</artifactId>
8180
<version>3.7.0</version>
8281
<configuration>
83-
<source>11</source>
84-
<target>11</target>
82+
<source>1.8</source>
83+
<target>1.8</target>
8584
</configuration>
8685
</plugin>
8786
<plugin>
@@ -127,7 +126,7 @@
127126
<dependency>
128127
<groupId>com.google.code.gson</groupId>
129128
<artifactId>gson</artifactId>
130-
<version>2.8.9</version>
129+
<version>2.7</version>
131130
</dependency>
132131
<dependency>
133132
<groupId>io.reactivex.rxjava2</groupId>
@@ -142,7 +141,7 @@
142141
<dependency>
143142
<groupId>commons-io</groupId>
144143
<artifactId>commons-io</artifactId>
145-
<version>2.10.0</version>
144+
<version>2.5</version>
146145
</dependency>
147146
<!-- Dependencies for test -->
148147
<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(encoding == null ? new InputStreamReader(input) : new InputStreamReader(input, encoding));
132+
BufferedReader reader = new BufferedReader(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;
1415
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 Responses.CompletionsResponseBody(Collections.emptyList());
49+
response.body = new ArrayList<>();
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: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017-2021 Microsoft Corporation and others.
2+
* Copyright (c) 2017-2020 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,6 +14,7 @@
1414
import java.util.Arrays;
1515
import java.util.List;
1616
import java.util.Map;
17+
import java.util.concurrent.CancellationException;
1718
import java.util.concurrent.CompletableFuture;
1819
import java.util.concurrent.CompletionException;
1920
import java.util.concurrent.ExecutionException;
@@ -105,58 +106,31 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
105106
indexedVariables = ((IntegerValue) sizeValue).value();
106107
}
107108
}
108-
} catch (Exception e) {
109-
logger.log(Level.INFO, "Failed to get the logical size of the variable", e);
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);
110113
}
111114
}
112115
int referenceId = 0;
113116
if (indexedVariables > 0 || (indexedVariables < 0 && value instanceof ObjectReference)) {
114117
referenceId = context.getRecyclableIdPool().addObject(threadId, varProxy);
115118
}
116119

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-
120+
String valueString = variableFormatter.valueToString(value, options);
131121
String detailsString = null;
132-
if (hasErrors) {
133-
// If failed to resolve the variable value, skip the details info as well.
134-
} else if (sizeValue != null) {
122+
if (sizeValue != null) {
135123
detailsString = "size=" + variableFormatter.valueToString(sizeValue, options);
136124
} else if (DebugSettings.getCurrent().showToString) {
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-
}
125+
detailsString = VariableDetailUtils.formatDetailsValue(value, stackFrameReference.getThread(), variableFormatter, options, engine);
146126
}
147127

148128
if ("clipboard".equals(evalArguments.context) && detailsString != null) {
149129
response.body = new Responses.EvaluateResponseBody(detailsString, -1, "String", 0);
150130
} 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-
}
158131
response.body = new Responses.EvaluateResponseBody((detailsString == null) ? valueString : valueString + " " + detailsString,
159-
referenceId, typeString, Math.max(indexedVariables, 0));
132+
referenceId, variableFormatter.typeToString(value == null ? null : value.type(), options),
133+
Math.max(indexedVariables, 0));
160134
}
161135
return response;
162136
}

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.net.MalformedURLException;
1717
import java.net.URISyntaxException;
1818
import java.nio.charset.Charset;
19+
import java.nio.charset.StandardCharsets;
1920
import java.nio.file.Path;
2021
import java.nio.file.Paths;
2122
import java.util.ArrayList;
@@ -90,21 +91,23 @@ protected CompletableFuture<Response> handleLaunchCommand(Arguments arguments, R
9091
"Failed to launch debuggee VM. Missing mainClass or modulePaths/classPaths options in launch configuration.",
9192
ErrorCode.ARGUMENT_MISSING);
9293
}
93-
if (StringUtils.isNotBlank(launchArguments.encoding)) {
94+
if (StringUtils.isBlank(launchArguments.encoding)) {
95+
context.setDebuggeeEncoding(StandardCharsets.UTF_8);
96+
} else {
9497
if (!Charset.isSupported(launchArguments.encoding)) {
9598
throw AdapterUtils.createCompletionException(
9699
"Failed to launch debuggee VM. 'encoding' options in the launch configuration is not recognized.",
97100
ErrorCode.INVALID_ENCODING);
98101
}
99102
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-
}
106103
}
107104

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+
}
108111
context.setLaunchMode(launchArguments.noDebug ? LaunchMode.NO_DEBUG : LaunchMode.DEBUG);
109112

110113
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 = "-cp \"" + String.join(File.pathSeparator, classPaths) + "\"";
76+
argfile = "-classpath \"" + 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: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,20 @@ 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();
149148

150149
// When a breakpoint occurs, abort any pending step requests from the same thread.
151150
if (event instanceof BreakpointEvent || event instanceof ExceptionEvent) {
152151
long threadId = ((LocatableEvent) event).thread().uniqueID();
153152
if (threadId == threadState.threadId && threadState.pendingStepRequest != null) {
154-
threadState.deleteStepRequest(eventRequestManager);
155-
threadState.deleteMethodExitRequest(eventRequestManager);
153+
threadState.deleteStepRequests(debugSession.getVM().eventRequestManager());
156154
context.getStepResultManager().removeMethodResult(threadId);
157155
if (threadState.eventSubscription != null) {
158156
threadState.eventSubscription.dispose();
159157
}
160158
}
161159
} else if (event instanceof StepEvent) {
162160
ThreadReference thread = ((StepEvent) event).thread();
163-
threadState.deleteStepRequest(eventRequestManager);
161+
threadState.deleteStepRequests(debugSession.getVM().eventRequestManager());
164162
if (isStepFiltersConfigured(context.getStepFilters())) {
165163
try {
166164
if (threadState.pendingStepType == Command.STEPIN) {
@@ -183,7 +181,6 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession,
183181
// ignore.
184182
}
185183
}
186-
threadState.deleteMethodExitRequest(eventRequestManager);
187184
if (threadState.eventSubscription != null) {
188185
threadState.eventSubscription.dispose();
189186
}
@@ -283,13 +280,10 @@ class ThreadState {
283280
Location stepLocation = null;
284281
Disposable eventSubscription = null;
285282

286-
public void deleteMethodExitRequest(EventRequestManager manager) {
283+
public void deleteStepRequests(EventRequestManager manager) {
284+
DebugUtility.deleteEventRequestSafely(manager, this.pendingStepRequest);
287285
DebugUtility.deleteEventRequestSafely(manager, this.pendingMethodExitRequest);
288286
this.pendingMethodExitRequest = null;
289-
}
290-
291-
public void deleteStepRequest(EventRequestManager manager) {
292-
DebugUtility.deleteEventRequestSafely(manager, this.pendingStepRequest);
293287
this.pendingStepRequest = null;
294288
}
295289
}

0 commit comments

Comments
 (0)