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 2022/07/27 08:47:19 UTC

[camel] branch camel-3.18.x updated (c73063f6ca0 -> 1720e901fe1)

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

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


    from c73063f6ca0 Upgrade Jackrabbit to 2.21.11
     new 13d9af755d2 Fix potential NPE in Kafka health checks (#8051)
     new 1720e901fe1 Potential NPE in health check

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/kafka/KafkaConsumerHealthCheck.java      |  9 +++++++--
 .../microprofile/health/CamelMicroProfileHealthHelper.java   | 12 +++++++-----
 .../java/org/apache/camel/main/http/VertxHttpServer.java     |  3 +++
 3 files changed, 17 insertions(+), 7 deletions(-)


[camel] 01/02: Fix potential NPE in Kafka health checks (#8051)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 13d9af755d27024632b51a2ac73e372590cab2b8
Author: Luca Burgazzoli <lb...@users.noreply.github.com>
AuthorDate: Wed Jul 27 10:46:36 2022 +0200

    Fix potential NPE in Kafka health checks (#8051)
    
    * Fix potential NPE
    
    * Don't add null values in HealthCheck.Result details
    
    In some cases, the client.id snd poitentially the bootstrap.server may
    not be set when the healt check result is computed, hence the need to
    add a null check.
---
 .../camel/component/kafka/KafkaConsumerHealthCheck.java      |  9 +++++++--
 .../microprofile/health/CamelMicroProfileHealthHelper.java   | 12 +++++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumerHealthCheck.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumerHealthCheck.java
index fa38ae54bc6..554df8a839f 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumerHealthCheck.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumerHealthCheck.java
@@ -59,8 +59,13 @@ public class KafkaConsumerHealthCheck extends AbstractHealthCheck {
 
                 KafkaConfiguration cfg = kafkaConsumer.getEndpoint().getConfiguration();
 
-                builder.detail("bootstrap.servers", healthState.getBootstrapServers());
-                builder.detail("client.id", healthState.getClientId());
+                if (healthState.getBootstrapServers() != null) {
+                    builder.detail("bootstrap.servers", healthState.getBootstrapServers());
+                }
+                if (healthState.getClientId() != null) {
+                    builder.detail("client.id", healthState.getClientId());
+                }
+
                 String gid = healthState.getGroupId();
                 if (gid != null) {
                     builder.detail("group.id", gid);
diff --git a/components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthHelper.java b/components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthHelper.java
index 819cbcebf6b..aa86fbdc428 100644
--- a/components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthHelper.java
+++ b/components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthHelper.java
@@ -46,12 +46,14 @@ final class CamelMicroProfileHealthHelper {
             Set<String> metaKeys = check.getMetaData().keySet();
 
             result.getDetails().forEach((key, value) -> {
-                if (exposureLevel.equals("full")) {
-                    builder.withData(key, value.toString());
-                } else {
-                    // Filter health check metadata to have a less verbose output
-                    if (!metaKeys.contains(key)) {
+                if (value != null) {
+                    if (exposureLevel.equals("full")) {
                         builder.withData(key, value.toString());
+                    } else {
+                        // Filter health check metadata to have a less verbose output
+                        if (!metaKeys.contains(key)) {
+                            builder.withData(key, value.toString());
+                        }
                     }
                 }
             });


[camel] 02/02: Potential NPE in health check

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1720e901fe10509952004bc73f6db4fc6dbf3493
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jul 27 10:46:26 2022 +0200

    Potential NPE in health check
---
 .../src/main/java/org/apache/camel/main/http/VertxHttpServer.java      | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/http/VertxHttpServer.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/http/VertxHttpServer.java
index 0d31b7b6af4..b1d20a26870 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/http/VertxHttpServer.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/http/VertxHttpServer.java
@@ -420,6 +420,9 @@ public final class VertxHttpServer {
             while (it.hasNext()) {
                 String k = it.next();
                 Object v = d.getDetails().get(k);
+                if (v == null) {
+                    v = ""; // in case of null value
+                }
                 boolean last = !it.hasNext();
                 sb.append("                 \"").append(k).append("\": \"").append(v).append("\"");
                 if (!last) {