You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/09/13 13:32:15 UTC

[camel] 01/02: CAMEL-13968: resolved HTTP header case sensitivity while parsing

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

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

commit 0c717966c285d5ecd84b7b93ef49d86d8c2a8307
Author: Maurice Betzel <ma...@betzel.net>
AuthorDate: Fri Sep 13 10:01:17 2019 +0200

    CAMEL-13968: resolved HTTP header case sensitivity while parsing
---
 .../component/as2/api/entity/EntityParser.java     | 50 +++++++---------------
 1 file changed, 15 insertions(+), 35 deletions(-)

diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
index bf36be4..921e699 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
@@ -203,15 +203,11 @@ public final class EntityParser {
             ContentType entityContentType = null;
             String entityContentTransferEncoding = null;
             for (Header header : headers) {
-                switch (header.getName()) {
-                case AS2Header.CONTENT_TYPE:
+                if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TYPE)) {
                     entityContentType = ContentType.parse(header.getValue());
-                    break;
-                case AS2Header.CONTENT_TRANSFER_ENCODING:
+                }
+                else if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TRANSFER_ENCODING)) {
                     entityContentTransferEncoding = header.getValue();
-                    break;
-                default:
-                    continue;
                 }
             }
             if (entityContentType == null) {
@@ -517,15 +513,11 @@ public final class EntityParser {
             ContentType signedEntityContentType = null;
             String signedEntityContentTransferEncoding = null;
             for (Header header : headers) {
-                switch (header.getName()) {
-                case AS2Header.CONTENT_TYPE:
+                if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TYPE)) {
                     signedEntityContentType = ContentType.parse(header.getValue());
-                    break;
-                case AS2Header.CONTENT_TRANSFER_ENCODING:
+                }
+                else if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TRANSFER_ENCODING)) {
                     signedEntityContentTransferEncoding = header.getValue();
-                    break;
-                default:
-                    continue;
                 }
             }
             if (signedEntityContentType == null) {
@@ -552,15 +544,11 @@ public final class EntityParser {
             ContentType signatureContentType = null;
             String signatureContentTransferEncoding = null;
             for (Header header : headers) {
-                switch (header.getName()) {
-                case AS2Header.CONTENT_TYPE:
+                if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TYPE)) {
                     signatureContentType = ContentType.parse(header.getValue());
-                    break;
-                case AS2Header.CONTENT_TRANSFER_ENCODING:
+                }
+                else if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TRANSFER_ENCODING)) {
                     signatureContentTransferEncoding = header.getValue();
-                    break;
-                default:
-                    continue;
                 }
             }
             if (signatureContentType == null) {
@@ -631,15 +619,11 @@ public final class EntityParser {
             ContentType textReportContentType = null;
             String textReportContentTransferEncoding = null;
             for (Header header : headers) {
-                switch (header.getName()) {
-                case AS2Header.CONTENT_TYPE:
+                if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TYPE)) {
                     textReportContentType = ContentType.parse(header.getValue());
-                    break;
-                case AS2Header.CONTENT_TRANSFER_ENCODING:
+                }
+                else if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TRANSFER_ENCODING)) {
                     textReportContentTransferEncoding = header.getValue();
-                    break;
-                default:
-                    continue;
                 }
             }
             if (textReportContentType == null) {
@@ -670,15 +654,11 @@ public final class EntityParser {
             ContentType dispositionNotificationContentType = null;
             String dispositionNotificationContentTransferEncoding = null;
             for (Header header : headers) {
-                switch (header.getName()) {
-                case AS2Header.CONTENT_TYPE:
+                if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TYPE)) {
                     dispositionNotificationContentType = ContentType.parse(header.getValue());
-                    break;
-                case AS2Header.CONTENT_TRANSFER_ENCODING:
+                }
+                else if (header.getName().equalsIgnoreCase(AS2Header.CONTENT_TRANSFER_ENCODING)) {
                     dispositionNotificationContentTransferEncoding = header.getValue();
-                    break;
-                default:
-                    continue;
                 }
             }
             if (dispositionNotificationContentType == null) {