snuyanzin commented on code in PR #29026:
URL: https://github.com/apache/flink/pull/29026#discussion_r3907518932
##########
flink-core/src/main/java/org/apache/flink/types/variant/BinaryVariantInternalBuilder.java:
##########
@@ -548,22 +567,36 @@ public int compareTo(FieldEntry other) {
}
}
- private void buildJson(JsonParser parser) throws IOException {
- JsonToken token = parser.currentToken();
+ /**
+ * Build an IOException enriched with the source's location, mirroring the
location that a
+ * Jackson JsonParseException used to carry before the builder was
decoupled from Jackson.
+ */
+ private static IOException parseError(JsonTokenSource source, String
message) {
+ final String location = source.currentLocation();
+ if (location == null) {
+ return new IOException(message);
+ }
+ return new IOException(message + "\n at " + location);
+ }
+
+ private void buildJson(JsonTokenSource source, JsonTokenSource.Token
token) throws IOException {
if (token == null) {
- throw new JsonParseException(parser, "Unexpected null token");
+ throw parseError(source, "Unexpected end of JSON input.");
}
switch (token) {
case START_OBJECT:
{
ArrayList<FieldEntry> fields = new ArrayList<>();
int start = writePos;
- while (parser.nextToken() != JsonToken.END_OBJECT) {
- String key = parser.currentName();
- parser.nextToken();
+ JsonTokenSource.Token next;
Review Comment:
use static import for `Token`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]