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

Potential NullPointerException when using a Struct with an Array field that contains a null value #1106

Closed
olavloite opened this issue Apr 27, 2021 · 0 comments · Fixed by #1107
Assignees
Labels
api: spanner Issues related to the googleapis/java-spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@olavloite
Copy link
Collaborator

If a Struct that contains an Array field, and that Array field contains a non-empty array with at least one null value, is encoded to a proto, a NullPointerException will occur. This is because the toProto method for these specific types of values use the primitive array fields instead of the List values.

@olavloite olavloite added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Apr 27, 2021
@olavloite olavloite self-assigned this Apr 27, 2021
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/java-spanner API. label Apr 27, 2021
olavloite added a commit that referenced this issue Apr 27, 2021
…d that contains null elements

A NullPointerException would be thrown when encoding the value to a proto if a Struct value was
constructed with an Array field that contained at least one null value, and the type of the array
field was boolArray, int64Array or float64Array.

Fixes #1106
thiagotnunes pushed a commit that referenced this issue Apr 27, 2021
…d that contains null elements (#1107)

A NullPointerException would be thrown when encoding the value to a proto if a Struct value was
constructed with an Array field that contained at least one null value, and the type of the array
field was boolArray, int64Array or float64Array.

Fixes #1106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant