cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Adding NPE guards to HTTP Headers utility, thanks to Raman Malisetti
Date Tue, 25 Nov 2014 21:35:53 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 0aa08eec6 -> 9283d10ad


Adding NPE guards to HTTP Headers utility, thanks to Raman Malisetti


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

Branch: refs/heads/master
Commit: 9283d10adb87d00e68b49444a3d2222469770bf8
Parents: 0aa08ee
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Nov 25 21:35:18 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Nov 25 21:35:18 2014 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/transport/http/Headers.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9283d10a/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 6c8dacd..620deb1 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
@@ -435,12 +435,18 @@ public class Headers {
             
             if (addHeaders || HTTP_HEADERS_SINGLE_VALUE_ONLY.contains(header)) {
                 for (int i = 0; i < headerList.size(); i++) {
-                    response.addHeader(header, headerObjectToString(headerList.get(i)));
+                    Object headerObject = headerList.get(i);
+                    if (headerObject != null) {
+                        response.addHeader(header, headerObjectToString(headerObject));
+                    }
                 }
             } else {
                 StringBuilder sb = new StringBuilder();
                 for (int i = 0; i < headerList.size(); i++) {
-                    sb.append(headerObjectToString(headerList.get(i)));
+                    Object headerObject = headerList.get(i);
+                    if (headerObject != null) {
+                        sb.append(headerObjectToString(headerObject));
+                    }
                     
                     if (i + 1 < headerList.size()) {
                         sb.append(',');


Mime
View raw message