handle "host is unresolved" error to prevent NPE in the JDK code

This commit is contained in:
Vladimir Krivosheev
2017-06-07 14:44:36 +02:00
parent faaeaf4ec2
commit 299bc04a53
2 changed files with 8 additions and 2 deletions
@@ -45,6 +45,12 @@ abstract class RemoteVmConnection : VmConnection<Vm>() {
@JvmOverloads
fun open(address: InetSocketAddress, stopCondition: Condition<Void>? = null): Promise<Vm> {
if (address.isUnresolved) {
val error = "Host ${address.hostString} is unresolved"
setState(ConnectionStatus.CONNECTION_FAILED, error)
return rejectedPromise(error)
}
this.address = address
@Suppress("DEPRECATION")
port = address.port
@@ -916,8 +916,8 @@ public class XDebugSessionImpl implements XDebugSession {
@Override
public void stop() {
ProcessHandler processHandler = myDebugProcess.getProcessHandler();
if (processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) return;
ProcessHandler processHandler = myDebugProcess == null ? null : myDebugProcess.getProcessHandler();
if (processHandler == null || processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) return;
if (processHandler.detachIsDefault()) {
processHandler.detachProcess();