Skip to content

Commit

Permalink
Move decode method before calling acquireSegment to avoid reference c…
Browse files Browse the repository at this point in the history
…ount leak (apache#7938)

Co-authored-by: Jack Li(Analytics Engineering) <jlli@jlli-mn1.linkedin.biz>
  • Loading branch information
jackjlli and Jack Li(Analytics Engineering) authored Dec 21, 2021
1 parent 03e8fcb commit 58e7f10
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ public String getSegmentMetadata(
@ApiParam(value = "Segment name", required = true) @PathParam("segmentName") String segmentName,
@ApiParam(value = "Column name", allowMultiple = true) @QueryParam("columns") @DefaultValue("")
List<String> columns) {
for (int i = 0; i < columns.size(); i++) {
try {
columns.set(i, URLDecoder.decode(columns.get(i), StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getCause());
}
}

TableDataManager tableDataManager = ServerResourceUtils.checkGetTableDataManager(_serverInstance, tableName);
try {
segmentName = URLDecoder.decode(segmentName, StandardCharsets.UTF_8.name());
Expand All @@ -271,14 +279,6 @@ public String getSegmentMetadata(
Response.Status.NOT_FOUND);
}

for (int i = 0; i < columns.size(); i++) {
try {
columns.set(i, URLDecoder.decode(columns.get(i), StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getCause());
}
}

try {
return SegmentMetadataFetcher.getSegmentMetadata(segmentDataManager, columns);
} catch (Exception e) {
Expand Down

0 comments on commit 58e7f10

Please sign in to comment.