-
Notifications
You must be signed in to change notification settings - Fork 110
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
Fixes Ion 1.1 symbols for opcodes E1-E3 #844
Conversation
We just hadn't implemented the feature yet, then we forgot about it. That explains the lack of tests. Everything was just following the existing 1.0 code path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like spotless is complaining about SeekableReaderTest in this build. I changed that in #842 on master, and applied our spotless rules to it. Why is it causing a failure on this branch? Spotless always compares against changes from master?
src/test/java/com/amazon/ion/impl/IonReaderContinuableCoreBinaryTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, noting the ktlint failure.
Yes. It does. If I can figure it out, I will change it to use the commit from |
Issue #, if available:
None
Description of changes:
Prior to this change, Op codes E1 - E3 were being handled incorrectly because of several problems:
IonReaderContinuableCoreBinary.readFixedUInt_1_1()
would start reading atpeekIndex
and stop atvalueMarker.endIndex
, butpeekindex
was not necessarily being set.IonTypeID
for OpcodeE3
has a length of-1
, and when reading the next value,IonCursorBinary
was blindly settingvalueMarker.endIndex
to one less than the start index.Changes:
symbolValueId()
now branches based on the Ion version. If it is Ion 1.1, it readsFixedUInt
rather thanUInt
.IonReaderContinuableCoreBinary.readFixedUInt_1_1()
now accepts a start and end index.IonTypeID
doesn't have a length prefix (i.e.variableLength == false
), and it haslength == -1
, (and it's not delimited), thenslowReadValueHeader()
andcalculateEndIndex_1_1()
now assume it to be aFlexInt
orFlexUInt
, and the length is calculated by looking at the continuation bits of the value.IonReaderContinuableCoreBinaryTest
.Why didn't we notice this sooner? Lack of proper unit testing, and maybe a bit of (bad) luck. Most of our test suite has symbol tables with less than 256 symbols, which means that (a) for the SIDs we were testing, there was no practical difference between big and little endian since they were only one byte long, and (b) we were not exercising opcodes
E2
andE3
in any meaningful way.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.