You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2018/07/26 19:24:53 UTC

httpcomponents-core git commit: Make enough room for two IPv6 addresses to avoid re-allocation in the StringBuilder.

Repository: httpcomponents-core
Updated Branches:
  refs/heads/master c4d0b325f -> 1d7a31173


Make enough room for two IPv6 addresses to avoid re-allocation in the
StringBuilder.

Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/1d7a3117
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/1d7a3117
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/1d7a3117

Branch: refs/heads/master
Commit: 1d7a31173a582e2915a9a85c366dedcf5400e6cd
Parents: c4d0b32
Author: Gary Gregory <gg...@apache.org>
Authored: Thu Jul 26 13:24:07 2018 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Thu Jul 26 13:24:07 2018 -0600

----------------------------------------------------------------------
 .../src/main/java/org/apache/hc/core5/http/EndpointDetails.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/1d7a3117/httpcore5/src/main/java/org/apache/hc/core5/http/EndpointDetails.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/EndpointDetails.java b/httpcore5/src/main/java/org/apache/hc/core5/http/EndpointDetails.java
index e9df621..fb1d921 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/EndpointDetails.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/EndpointDetails.java
@@ -96,7 +96,8 @@ public abstract class EndpointDetails implements HttpConnectionMetrics {
 
     @Override
     public String toString() {
-        final StringBuilder buffer = new StringBuilder();
+        // Make enough room for two IPv6 addresses to avoid re-allocation in the StringBuilder.
+        final StringBuilder buffer = new StringBuilder(78);
         InetAddressUtils.formatAddress(buffer, localAddress);
         buffer.append("<->");
         InetAddressUtils.formatAddress(buffer, remoteAddress);