Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when header value is null #56

Closed
cadu-goncalves opened this issue May 8, 2019 · 7 comments
Closed

NPE when header value is null #56

cadu-goncalves opened this issue May 8, 2019 · 7 comments
Labels
bug Something isn't working

Comments

@cadu-goncalves
Copy link

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
Copy link
Owner

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

@tchiotludo tchiotludo added the bug Something isn't working label May 8, 2019
tchiotludo added a commit that referenced this issue May 8, 2019
@cadu-goncalves
Copy link
Author

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
Copy link
Owner

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 ⌛

ghost pushed a commit that referenced this issue Jun 19, 2020
@lostiniceland
Copy link

@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
Copy link
Owner

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

@lostiniceland
Copy link

lostiniceland commented Aug 12, 2022

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
Copy link
Owner

@lostiniceland : please create a new issue please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants