tchiotludo / akhq

Kafka GUI for Apache Kafka to manage topics, topics data, consumers group, schema registry, connect and more...
https://akhq.io/
Apache License 2.0
3.34k stars 646 forks source link

NPE when header value is null #56

Closed cadu-goncalves closed 5 years ago

cadu-goncalves commented 5 years ago

Found an issue on class org.kafkahq.models.Record, if an header has value null a NPE occurs on line 40:

    this.headers.put(header.key(), new String(header.value()));

Suggestion:

        for (Header header: record.headers()) {
            if(Objects.isNull(header.value())) {
                this.headers.put(header.key(), "");
            } else {
                this.headers.put(header.key(), new String(header.value()));
            }
        }
tchiotludo commented 5 years ago

I've decided to handled null value on the whole application and displayed a true null Thanks for the report !

cadu-goncalves commented 5 years ago

OK, I've built an image based on dev branch, works pretty well. I've just used the Dockerfile from master branch in order to get a runnable image. Thank you!

tchiotludo commented 5 years ago

Glad to know it ! FYI, normally docker image dev is available : https://hub.docker.com/r/tchiotludo/kafkahq/tags But I've a test that failed on dev image preventing the build to be done :hourglass:

lostiniceland commented 2 years ago

@tchiotludo We just moved from KafkaHQ to AKHQ and in the current version the UI filters out any header with a null value. This is bad for analysis since we just had the case where a null header was wronly published which caused an Exception in the application. Luckily we still had the old version running where I was able to find the problematic key. Should I open a new issue for this? Maybe have a config option what should be filtered and what not.

tchiotludo commented 2 years ago

@lostiniceland can you provide a screenshot please ? I don't understand exactly the issue

lostiniceland commented 2 years ago

KafkaHQ 0.11 (skipped after the important header) grafik

AKHA 0.21 grafik

Both views show the same message (highlighted by uuid). Offset is 18. While KafkaHq shows 19 headers including the one with null AKHQ 0.21 only shows 18 headers.

tchiotludo commented 1 year ago

@lostiniceland : please create a new issue please