cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6380] Using Multivaluedmap.getFirst
Date Fri, 22 May 2015 12:28:01 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 029be16dd -> 6f3f4c1f8


[CXF-6380] Using Multivaluedmap.getFirst


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

Branch: refs/heads/master
Commit: 6f3f4c1f873d8d30a4c30165280dd0ff46e03d5d
Parents: 029be16
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri May 22 13:27:31 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri May 22 13:27:31 2015 +0100

----------------------------------------------------------------------
 .../cxf/jaxrs/tracing/htrace/HTraceProvider.java | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6f3f4c1f/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceProvider.java
b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceProvider.java
index 57dc29a..a32f41c 100644
--- a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceProvider.java
+++ b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceProvider.java
@@ -19,7 +19,6 @@
 package org.apache.cxf.jaxrs.tracing.htrace;
 
 import java.io.IOException;
-import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -95,20 +94,14 @@ public class HTraceProvider implements ContainerRequestFilter, ContainerResponse
     
     private static Long getFirstValueOrDefault(final MultivaluedMap<String, String>
headers, 
             final String header, final long defaultValue) {
-        
-        if (!headers.containsKey(header)) {
-            return defaultValue;
-        }
-        
-        try {
-            final List< String > values = headers.get(header);
-            if (values != null && !values.isEmpty()) {
-                return Long.parseLong(values.get(0));
+        String value = headers.getFirst(header);
+        if (value != null) {
+            try {
+                return Long.parseLong(value);
+            } catch (NumberFormatException ex) {
+                LOG.log(Level.FINE, String.format("Unable to parse '%s' header value to long
number", header), ex);
             }
-        } catch (NumberFormatException ex) {
-            LOG.log(Level.FINE, String.format("Unable to parse '%s' header value to long
number", header), ex);
         }
-        
         return defaultValue;
     }
 }


Mime
View raw message