You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/10/05 07:36:27 UTC

[camel] 01/02: (chores) camel-aws-xray: prevent a NPE

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

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

commit 6759031bad231ea067e12f75d17510501ab4db8b
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Oct 4 16:42:48 2022 +0200

    (chores) camel-aws-xray: prevent a NPE
    
    Although unlikely, it's possible for an NPE to be thrown if the URI is malformed
---
 .../component/aws/xray/decorators/http/RestSegmentDecorator.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/components/camel-aws/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestSegmentDecorator.java b/components/camel-aws/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestSegmentDecorator.java
index fb1ca618b8c..e32c642c37f 100644
--- a/components/camel-aws/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestSegmentDecorator.java
+++ b/components/camel-aws/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/decorators/http/RestSegmentDecorator.java
@@ -71,7 +71,7 @@ public class RestSegmentDecorator extends AbstractHttpSegmentDecorator {
                 try {
                     path = URLDecoder.decode(path, "UTF-8");
                 } catch (UnsupportedEncodingException e) {
-                    LOG.debug("Failed to decode URL path '" + path + "', ignoring exception", e);
+                    LOG.warn("Failed to decode URL path '{}', ignoring exception", path, e);
                 }
             }
         }
@@ -79,6 +79,11 @@ public class RestSegmentDecorator extends AbstractHttpSegmentDecorator {
     }
 
     protected static List<String> getParameters(String path) {
+        if (path == null) {
+            LOG.warn("The provided path is null and has no parameters to be evaluated");
+            return Collections.emptyList();
+        }
+
         List<String> parameters = null;
 
         int startIndex = path.indexOf('{');