-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix ignoring trailing JSON content in various places #12907
Conversation
17fe4bd
to
11f054a
Compare
11f054a
to
f286a40
Compare
T value = mapper.readerFor(javaType).readValue(parser); | ||
checkArgument(parser.nextToken() == null, "Found characters after the expected end of input"); | ||
return value; | ||
} |
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.
Similar change in Airlift: airlift/airlift#995
f286a40
to
781a2c6
Compare
22d03c4
to
962545d
Compare
Reviews welcome. |
@@ -136,7 +137,7 @@ public static DeltaLakeTransactionLogEntry parseJson(String json) | |||
if (json.endsWith("x")) { | |||
json = json.substring(0, json.length() - 1); | |||
} | |||
return OBJECT_MAPPER.readValue(json, DeltaLakeTransactionLogEntry.class); | |||
return JsonUtils.parseJson(OBJECT_MAPPER, json, DeltaLakeTransactionLogEntry.class); |
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.
nit: static import
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.
this is within local parseJson
method (name conflict)
@@ -83,7 +84,7 @@ private Optional<TableStatisticsData> readStatistics(String resourcePath) | |||
return Optional.empty(); | |||
} | |||
try { | |||
return Optional.of(objectMapper.readValue(resource, TableStatisticsData.class)); | |||
return Optional.of(JsonUtils.parseJson(objectMapper, resource, TableStatisticsData.class)); |
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.
nit: static import
962545d
to
5f5b914
Compare
Follow-up to #12862 and #10783