From 01df2c28e326d0e48de30e6cb01b9524cdde7038 Mon Sep 17 00:00:00 2001 From: Ivan <1134608+idarmans@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:52:29 -0700 Subject: [PATCH] Add symbol ID in the exception message when protobuf fails to resolve string references (#1021) * Add symbol ID in the exception message when protobuf fails to resolve string references * Bump version to 29.58.9 * Add diff link --- CHANGELOG.md | 6 +++++- .../java/com/linkedin/data/codec/ProtobufDataCodec.java | 5 +++-- .../data/codec/entitystream/ProtobufDataDecoder.java | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a526f0b45..f33e90feee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ and what APIs have changed, if applicable. ## [Unreleased] +## [29.58.10] - 2024-09-24 +- Add symbol ID in the exception message when protobuf fails to resolve string references. + ## [29.58.9] - 2024-09-24 - Fix invalid handling of glob collections for wildcard subscribers @@ -5737,7 +5740,8 @@ patch operations can re-use these classes for generating patch messages. ## [0.14.1] -[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.58.9...master +[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.58.10...master +[29.58.10]: https://github.com/linkedin/rest.li/compare/v29.58.9...v29.58.10 [29.58.9]: https://github.com/linkedin/rest.li/compare/v29.58.8...v29.58.9 [29.58.8]: https://github.com/linkedin/rest.li/compare/v29.58.7...v29.58.8 [29.58.7]: https://github.com/linkedin/rest.li/compare/v29.58.6...v29.58.7 diff --git a/data/src/main/java/com/linkedin/data/codec/ProtobufDataCodec.java b/data/src/main/java/com/linkedin/data/codec/ProtobufDataCodec.java index d5ac959ded..1b3e0bfd5f 100644 --- a/data/src/main/java/com/linkedin/data/codec/ProtobufDataCodec.java +++ b/data/src/main/java/com/linkedin/data/codec/ProtobufDataCodec.java @@ -258,9 +258,10 @@ protected final DataMap readMap(ProtoReader reader) throws IOException protected final String readStringReference(ProtoReader reader) throws IOException { String value; - if ((value = _options.getSymbolTable().getSymbolName(reader.readInt32())) == null) + int symbolId = reader.readInt32(); + if ((value = _options.getSymbolTable().getSymbolName(symbolId)) == null) { - throw new DataDecodingException("Error decoding string reference"); + throw new DataDecodingException("Error decoding string reference. Symbol ID: " + symbolId); } return value; } diff --git a/data/src/main/java/com/linkedin/data/codec/entitystream/ProtobufDataDecoder.java b/data/src/main/java/com/linkedin/data/codec/entitystream/ProtobufDataDecoder.java index 2d57105296..90c8ee5358 100644 --- a/data/src/main/java/com/linkedin/data/codec/entitystream/ProtobufDataDecoder.java +++ b/data/src/main/java/com/linkedin/data/codec/entitystream/ProtobufDataDecoder.java @@ -266,7 +266,7 @@ private Token readStringReference() throws IOException } if ((_stringValue = _symbolTable.getSymbolName(_intValue)) == null) { - throw new DataDecodingException("Error decoding string reference"); + throw new DataDecodingException("Error decoding string reference. Symbol ID: " + _intValue); } return STRING; }