hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asan...@apache.org
Subject svn commit: r1143789 - in /httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio: DefaultNHttpClientConnection.java DefaultNHttpServerConnection.java reactor/IOSessionImpl.java
Date Thu, 07 Jul 2011 12:18:55 GMT
Author: asankha
Date: Thu Jul  7 12:18:55 2011
New Revision: 1143789

URL: http://svn.apache.org/viewvc?rev=1143789&view=rev
Log:
avoid NPE when address is unresolved and connection debugging is used

Modified:
    httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
    httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
    httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java

Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java?rev=1143789&r1=1143788&r2=1143789&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
(original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
Thu Jul  7 12:18:55 2011
@@ -264,11 +264,11 @@ public class DefaultNHttpClientConnectio
             final InetSocketAddress remote = ((InetSocketAddress) this.session.getRemoteAddress());
             final InetSocketAddress local  = ((InetSocketAddress) this.session.getLocalAddress());
 
-            buf.append(local.getAddress().getHostAddress())
+            buf.append(local.getAddress() != null ? local.getAddress().getHostAddress() :
local.getAddress())
             .append(':')
             .append(local.getPort())
             .append("->")
-            .append(remote.getAddress().getHostAddress())
+            .append(remote.getAddress() != null ? remote.getAddress().getHostAddress() :
remote.getAddress())
             .append(':')
             .append(remote.getPort());
 

Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java?rev=1143789&r1=1143788&r2=1143789&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
(original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
Thu Jul  7 12:18:55 2011
@@ -266,11 +266,11 @@ public class DefaultNHttpServerConnectio
             final InetSocketAddress remote = ((InetSocketAddress) this.session.getRemoteAddress());
             final InetSocketAddress local  = ((InetSocketAddress) this.session.getLocalAddress());
 
-            buf.append(remote.getAddress().getHostAddress())
+            buf.append(remote.getAddress() != null ? remote.getAddress().getHostAddress()
: remote.getAddress())
             .append(':')
             .append(remote.getPort())
             .append("->")
-            .append(local.getAddress().getHostAddress())
+            .append(local.getAddress() != null ? local.getAddress().getHostAddress() : local.getAddress())
             .append(':')
             .append(local.getPort());
 

Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?rev=1143789&r1=1143788&r2=1143789&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
(original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Thu Jul  7 12:18:55 2011
@@ -316,11 +316,11 @@ public class IOSessionImpl implements IO
             final InetSocketAddress remote = ((InetSocketAddress) getRemoteAddress());
             final InetSocketAddress local  = ((InetSocketAddress) getLocalAddress());
 
-            buffer.append(local.getAddress().getHostAddress())
+            buffer.append(local.getAddress() != null ? local.getAddress().getHostAddress()
: local.getAddress())
             .append(':')
             .append(local.getPort())
             .append("<->")
-            .append(remote.getAddress().getHostAddress())
+            .append(remote.getAddress() != null ? remote.getAddress().getHostAddress() :
remote.getAddress())
             .append(':')
             .append(remote.getPort());
 



Mime
View raw message