[CXF-6227] Avoid string concatenation when not required for the current log 
level

Conflicts:
        
rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java


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

Branch: refs/heads/2.7.x-fixes
Commit: bfbce4beef8a5a9cc96c63f5d82cb3409221a466
Parents: c9c00bd
Author: Alessio Soldano <[email protected]>
Authored: Fri Jan 30 12:41:15 2015 +0100
Committer: Daniel Kulp <[email protected]>
Committed: Mon Feb 9 13:13:19 2015 -0500

----------------------------------------------------------------------
 .../java/org/apache/cxf/transport/http/Headers.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bfbce4be/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
----------------------------------------------------------------------
diff --git 
a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java 
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
index 814c082..a95f06f 100644
--- 
a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
+++ 
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
@@ -251,11 +251,13 @@ public class Headers {
      * @param headers The Message protocol headers.
      */
     void logProtocolHeaders(Level level) {
-        for (String header : headers.keySet()) {
-            List<String> headerList = headers.get(header);
-            for (String value : headerList) {
-                LOG.log(level, header + ": "
-                    + (value == null ? "<null>" : value.toString()));
+        if (LOG.isLoggable(level)) {
+            for (String header : headers.keySet()) {
+                List<String> headerList = headers.get(header);
+                for (String value : headerList) {
+                    LOG.log(level, header + ": "
+                            + (value == null ? "<null>" : value.toString()));
+                }
             }
         }
     }

Reply via email to