You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2020/04/29 13:40:20 UTC

[cxf] branch master updated: HttpAuthHeader: use String.join

This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 2d2e384  HttpAuthHeader: use String.join
2d2e384 is described below

commit 2d2e3846b04fa64ca25e61900b478b429778c479
Author: Alexey Markevich <bu...@gmail.com>
AuthorDate: Wed Apr 29 16:39:26 2020 +0300

    HttpAuthHeader: use String.join
---
 .../apache/cxf/transport/http/auth/HttpAuthHeader.java | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java
index 3b53c2e..6d3b37d 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthHeader.java
@@ -30,10 +30,10 @@ public final class HttpAuthHeader {
     public static final String AUTH_TYPE_DIGEST = "Digest";
     public static final String AUTH_TYPE_NEGOTIATE = "Negotiate";
 
-    private String fullHeader;
-    private String authType;
-    private String fullContent;
-    private Map<String, String> params;
+    private final String fullHeader;
+    private final String authType;
+    private final String fullContent;
+    private final Map<String, String> params;
 
     public HttpAuthHeader(String fullHeader) {
         this.fullHeader = (fullHeader == null) ? "" : fullHeader;
@@ -48,15 +48,7 @@ public final class HttpAuthHeader {
         this.params = parseHeader();
     }
     public HttpAuthHeader(List<String> params) {
-        boolean first = true;
-        for (String s : params) {
-            if (!first) {
-                fullHeader += ", " + s;
-            } else {
-                first = false;
-                fullHeader = s;
-            }
-        }
+        fullHeader = String.join(", ", params);
         int spacePos = this.fullHeader.indexOf(' ');
         if (spacePos == -1) {
             this.authType = this.fullHeader;