diff options
author | Sebastien Hertz <shertz@google.com> | 2017-04-10 11:57:32 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-04-10 11:57:32 +0000 |
commit | 487a506185e787ef6d803ec7156b2fc8dea93cd2 (patch) | |
tree | 6daa74c4a0784c9bbf8d96dcaee26363f62a2284 | |
parent | f09b8fce42690122d17c6fdc4b1500b4af0c3828 (diff) | |
parent | 7ebb62b4c7f5abfa523104553274ee9cc05bb87c (diff) | |
download | apache-harmony-487a506185e787ef6d803ec7156b2fc8dea93cd2.tar.gz |
Merge "Workaround localhost issues on old runtimes" am: c7f73eb9b3
am: 7ebb62b4c7
Change-Id: I7063ff4b06de1170b1cfb96b341088c93e9cd49c
-rw-r--r-- | jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/SocketTransportWrapper.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/SocketTransportWrapper.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/SocketTransportWrapper.java index 74fe05f..2a8eeb0 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/SocketTransportWrapper.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/SocketTransportWrapper.java @@ -95,7 +95,11 @@ public class SocketTransportWrapper implements TransportWrapper { iAddress = InetAddress.getLocalHost(); } - address = iAddress.getHostName() + ":" + serverSocket.getLocalPort(); + // Older Android runtimes may fail to resolve 'localhost' on a host machine. The workaround + // is to use the address instead of the hostname. + String hostNameOrAddress = + iAddress.isLoopbackAddress() ? iAddress.getHostAddress() : iAddress.getHostName(); + address = hostNameOrAddress + ":" + serverSocket.getLocalPort(); return address; } |