You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2016/05/31 11:57:12 UTC

aries-rsa git commit: [ARIES-1556] Don't fail if local host cannot be resolved. Closes #3 [Forced Update!]

Repository: aries-rsa
Updated Branches:
  refs/heads/master fd85eb256 -> ea825a3c3 (forced update)


[ARIES-1556] Don't fail if local host cannot be resolved. Closes #3


Project: http://git-wip-us.apache.org/repos/asf/aries-rsa/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-rsa/commit/ea825a3c
Tree: http://git-wip-us.apache.org/repos/asf/aries-rsa/tree/ea825a3c
Diff: http://git-wip-us.apache.org/repos/asf/aries-rsa/diff/ea825a3c

Branch: refs/heads/master
Commit: ea825a3c3d2e7d7cdafdae84544d77fb631c0ba3
Parents: d79fe5f
Author: Johannes Utzig <j....@seeburger.de>
Authored: Tue May 31 11:46:34 2016 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Tue May 31 13:56:15 2016 +0200

----------------------------------------------------------------------
 .../aries/rsa/provider/fastbin/tcp/TcpTransport.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/ea825a3c/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java
----------------------------------------------------------------------
diff --git a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java
index c46417c..c30af51 100644
--- a/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java
+++ b/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransport.java
@@ -247,11 +247,17 @@ public class TcpTransport implements Transport {
     }
 
     protected String resolveHostName(String host) throws UnknownHostException {
-        String localName = InetAddress.getLocalHost().getHostName();
-        if (localName != null && isUseLocalHost()) {
-            if (localName.equals(host)) {
-                return "localhost";
+        try {
+            if(isUseLocalHost()) {
+                String localName = InetAddress.getLocalHost().getHostName();
+                if (localName != null) {
+                    if (localName.equals(host)) {
+                        return "localhost";
+                    }
+                }
             }
+        } catch (Exception e) {
+            LOG.warn("Failed to resolve local host address",e);
         }
         return host;
     }