cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject [2/3] cxf git commit: [CXF-6227] Avoid string concatenation when not required for the current log level
Date Fri, 30 Jan 2015 17:05:27 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/d5315e07
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d5315e07
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d5315e07

Branch: refs/heads/master
Commit: d5315e072b8dd5222ede6f8e47c1e3e645209f59
Parents: eb9e13e
Author: Alessio Soldano <asoldano@redhat.com>
Authored: Fri Jan 30 12:41:15 2015 +0100
Committer: Alessio Soldano <asoldano@redhat.com>
Committed: Fri Jan 30 12:41:15 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/d5315e07/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