You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/03/02 09:02:58 UTC

[camel] branch camel-3.7.x updated: CAMEL-16283: Fixed camel-jetty NPE in query parsing

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

davsclaus pushed a commit to branch camel-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.7.x by this push:
     new 4d3d77d  CAMEL-16283: Fixed camel-jetty NPE in query parsing
4d3d77d is described below

commit 4d3d77d268d052aa773cf94ccb1840d84f0a2514
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 2 09:59:28 2021 +0100

    CAMEL-16283: Fixed camel-jetty NPE in query parsing
---
 .../java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java
index ed26cd1..1026920 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/AttachmentHttpBinding.java
@@ -95,12 +95,13 @@ final class AttachmentHttpBinding extends DefaultHttpBinding {
             jettyRequest.getHttpFields().remove(Exchange.CONTENT_ENCODING);
         }
 
+        // attachment is optional
         AttachmentMessage am = message.getExchange().getMessage(AttachmentMessage.class);
 
         Enumeration<?> names = request.getParameterNames();
         while (names.hasMoreElements()) {
             String name = (String) names.nextElement();
-            if (am.getAttachment(name) != null) {
+            if (am != null && am.getAttachment(name) != null) {
                 DataHandler dh = am.getAttachment(name);
                 Object value = dh;
                 if (dh.getContentType() == null || dh.getContentType().startsWith("text/plain")) {