FasterXML / jackson-dataformats-binary

Uber-project for standard Jackson binary format backends: avro, cbor, ion, protobuf, smile
Apache License 2.0
310 stars 133 forks source link

Fix #311 by wrapping IonExceptions in IonParser #313

Closed popematt closed 2 years ago

popematt commented 2 years ago

Moves the calls to IonReader.stringValue(), IonReader.getTypeAnnotations(), IonReader.getFieldName(), and IonReader.next() into try/catch blocks so that IonExceptions can be caught and wrapped in a JsonParseException.

This change cannot go into 2.13 because it adds a new checked exception to IonParser.getTypeAnnotations(), which changes the public API. However, searching for uses of this method on GitHub doesn't reveal any uses of it aside from other places in jackson-dataformats-binary, so including it in 2.14 (rather than 3.0) is unlikely to cause problems for any consumers of this library.

cowtowncoder commented 2 years ago

Sounds good. I assume your contribution would be covered by Amazon CCLA? If so, let me know and I can merge this in for inclusion.

Thank you for doing the due diligence here wrt compatibility, tests, much appreciated! Really wish more contributions were this thoughtful (many are, but even more!).

popematt commented 2 years ago

I have a personal CCLA, and I believe I am covered by the Amazon CCLA. (If I must choose one, then it's probably best to go with the Amazon CCLA.)

cowtowncoder commented 2 years ago

Ok that's great -- I do not have to choose (there is no direct linkage between PR/issue and CLA), just want to make sure there is one on file. Apologies for forgetting that you just sent the personal one month ago. :)