-
Notifications
You must be signed in to change notification settings - Fork 29
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
null handling for opaque (byte[]) data #18
Comments
note - this does not apply to unions, just "plain" variable length opaque fields |
I think null values for a vector can be treated as a zero length array. The rpcgen code have to be updated as well to generate corresponding encoders. |
0 length array and null are not equivalent. the closesnt approximation i've been able to come up with is this:
this leaves the Value.data field actually null (but requires Value.notNull = false to work). the issue here is that: 1 oncrpc4j doesnt generate any setters for this at all. so user code ends up looking like: Value res = new Value();
if (value != null) {
res.notNull = true;
res.data = value;
} 2 on top of getters/setters would be nice if oncrpc4j could recognize the boolean flag has no meaning and just have getData()/setData() - that return/accept null and update the flag accordingly. i realize this "optimization" would only work for non-primitive fields covered under a boolean union variable. i'll open a pull request with the above test scenario |
i've opened a pull request #19 with the blob store code above (as a test) |
if you leave an opaque value null, you get something like this:
im not sure if anything can be done, since the specs (rfcs 1014, 1832 and 4056) dont say anything about nulls. and variable-length fields are encoded starting with the length as an unsigned number ...
im opening this just to verify that this should be treated as user error.
The text was updated successfully, but these errors were encountered: