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 2017/07/25 22:25:23 UTC

httpcomponents-client git commit: [HTTPCLIENT-1858] Clone some code from Log4j 2 to cache a StringBuilder in a ThreadLocal. Update to use the StringBuilder's capacity instead of its length to measure upper bound.

Repository: httpcomponents-client
Updated Branches:
  refs/heads/master 49d5898da -> 888cefb7c


[HTTPCLIENT-1858] Clone some code from Log4j 2 to cache a StringBuilder
in a ThreadLocal. Update to use the StringBuilder's capacity instead of
its length to measure upper bound.

Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/888cefb7
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/888cefb7
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/888cefb7

Branch: refs/heads/master
Commit: 888cefb7cd39cff379321096e1c2519d6adbe93c
Parents: 49d5898
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Jul 25 15:25:20 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Jul 25 15:25:20 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hc/client5/http/impl/logging/Wire.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/888cefb7/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java
index e6b09b1..8bd9e4f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java
@@ -64,7 +64,7 @@ class Wire {
      */
     // TODO Delete wheb Log4j's 2.9 (see #trimToMaxSize(StringBuild))
     private static void trimToMaxSize(final StringBuilder stringBuilder, final int maxSize) {
-        if (stringBuilder != null && stringBuilder.length() > maxSize) {
+        if (stringBuilder != null && stringBuilder.capacity() > maxSize) {
             stringBuilder.setLength(maxSize);
             stringBuilder.trimToSize();
         }