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

Ensures the binary IonReader throws when a value method that returns a primitive type is invoked on a null value. #693

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

tgregg
Copy link
Contributor

@tgregg tgregg commented Jan 10, 2024

Issue #, if available:
#684 (note: this should also be done for the text reader)

Description of changes:
The pre-1.11.0 binary reader would allow this in some cases, returning some form of 0 rather than throwing. If that behavior is desirable in certain applications, those applications should use IonReader.isNullValue() to check nullness and decide whether using a zero value in that case makes sense.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (78537ce) 67.25% compared to head (cab1ccf) 67.24%.

Files Patch % Lines
...mazon/ion/impl/IonReaderContinuableCoreBinary.java 75.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #693      +/-   ##
============================================
- Coverage     67.25%   67.24%   -0.02%     
- Complexity     5485     5487       +2     
============================================
  Files           159      159              
  Lines         23019    23027       +8     
  Branches       4124     4128       +4     
============================================
+ Hits          15482    15485       +3     
- Misses         6255     6259       +4     
- Partials       1282     1283       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 395 to 412

@Test
public void expectAttemptToParseNullScalarAsJavaPrimitiveToFailCleanly() {
IonReaderContinuableCoreBinary reader = initializeReader(
true,
0xE0, 0x01, 0x00, 0xEA,
0x0F, // null.null
0x1F, // null.bool
0x2F, // null.int
0x3F, // null.int
0x4F, // null.float
0x5F // null.decimal
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be broken up into multiple tests

…a primitive type is invoked on a null value.
@tgregg tgregg merged commit b71a6e2 into master Jan 17, 2024
21 of 35 checks passed
@tgregg tgregg deleted the null-not-zero branch January 17, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants