cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject [2/4] cxf git commit: [CXF-6227] Avoid string concatenation when not required for the current log level
Date Mon, 02 Feb 2015 09:54:53 GMT
[CXF-6227] Avoid string concatenation when not required for the current log level


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

Branch: refs/heads/3.0.x-fixes
Commit: 34f0aa64965e0c100d3d276b75a31f606b05c65c
Parents: c1f2b80
Author: Alessio Soldano <asoldano@redhat.com>
Authored: Fri Jan 30 12:41:15 2015 +0100
Committer: Alessio Soldano <asoldano@redhat.com>
Committed: Mon Feb 2 10:32:55 2015 +0100

----------------------------------------------------------------------
 .../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/34f0aa64/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 19c1538..83f31e1 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
@@ -276,11 +276,13 @@ public class Headers {
      * @param headers The Message protocol headers.
      */
     void logProtocolHeaders(Level level) {
-        for (String header : headers.keySet()) {
-            List<?> headerList = headers.get(header);
-            for (Object value : headerList) {
-                LOG.log(level, header + ": " 
-                    + (value == null ? "<null>" : value.toString()));
+        if (LOG.isLoggable(level)) {
+            for (String header : headers.keySet()) {
+                List<?> headerList = headers.get(header);
+                for (Object value : headerList) {
+                    LOG.log(level, header + ": " 
+                        + (value == null ? "<null>" : value.toString()));
+                }
             }
         }
     }


Mime
View raw message