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

StructArrayEncoder.string does not handle null values #226

Open
AbfrmBlr opened this issue Dec 8, 2016 · 3 comments
Open

StructArrayEncoder.string does not handle null values #226

AbfrmBlr opened this issue Dec 8, 2016 · 3 comments

Comments

@AbfrmBlr
Copy link
Contributor

AbfrmBlr commented Dec 8, 2016

StructArrayEncoder.string thorws null pointer for a null value, where as StructEncoder behaves normally and does a null check to avoid NPE. Should the runnel api allow null values for string, or the user should only encode the field if it's non-null.

@lorban
Copy link
Contributor

lorban commented Dec 9, 2016

This is a good question: so far, runnel only allows primitive types (int, long, double...) in the encoding APIs, and non-primitives like String, Enm and ByteBuffer are null-checked.

We could change the API so that runnel would accept wrapper types (Integer, Long, Double) instead of primitives and perform the null checks internally. That would make the API a bit more fluent.

That needs to be pondered to make sure that wouldn't create ill effects, obviously.

@ChrisGreenaway
Copy link
Contributor

I think the question is about two different string methods, not the difference between String and primitives.

StructArrayEncoder.string vs StructEncoder.string

@lorban
Copy link
Contributor

lorban commented Dec 9, 2016

@ChrisGreenaway it is; but when you think about it, it would make sense to avoid having to code null checks for all types, and not only strings. Don't you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants