From a22cd0c1a2e428ded2c6fe8b3628f92a1cf53129 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Mon, 12 Jul 2010 20:19:05 +0400 Subject: [PATCH] include local host name in launching parameters for listening mode --- .../configurations/RemoteConnection.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/java/execution/openapi/src/com/intellij/execution/configurations/RemoteConnection.java b/java/execution/openapi/src/com/intellij/execution/configurations/RemoteConnection.java index aeb8cf6c0d1f..a08efdc933e1 100644 --- a/java/execution/openapi/src/com/intellij/execution/configurations/RemoteConnection.java +++ b/java/execution/openapi/src/com/intellij/execution/configurations/RemoteConnection.java @@ -17,6 +17,9 @@ package com.intellij.execution.configurations; import org.jetbrains.annotations.NonNls; +import java.net.InetAddress; +import java.net.UnknownHostException; + public class RemoteConnection { private boolean myUseSockets; private boolean myServerMode; @@ -90,8 +93,18 @@ public class RemoteConnection { catch (NumberFormatException e) { } if (serverMode) { - result = "-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=" + - ((p == -1)? "..." : Integer.toString(p)) + + String localHostName = ":"; + try { + final InetAddress localAddress = InetAddress.getLocalHost(); + final String name = localAddress.getCanonicalHostName(); + if (name != null) { + localHostName = name + ":"; + } + } + catch (UnknownHostException e) { + } + result = "-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=" + localHostName + + ((p == -1)? "" : Integer.toString(p)) + ONTHROW + ",suspend=y" + ONUNCAUGHT; } else {