Skip to content

Commit

Permalink
chore: Don't use .subList like it's a List (appsmithorg#32238)
Browse files Browse the repository at this point in the history
Instead or getting the sub-list and returning that, which would be an
instance of `ArrayList$SubList`, we instead remove the extra items in
the original `ArrayList` and return that itself.

This is because the `SubList` objects are just _views_ on the underlying
`ArrayList` object, and cannot be serialized by Hibernate directly.
  • Loading branch information
sharat87 authored Mar 29, 2024
1 parent 77e7ebc commit af69c69
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected List<String> addIdToRecentList(List<String> srcIdList, String newId, i
}
// keeping the last maxSize ids, there may be a lot of ids which are not used anymore
if (srcIdList.size() > maxSize) {
srcIdList = srcIdList.subList(0, maxSize);
srcIdList.subList(maxSize, srcIdList.size()).clear();
}
return srcIdList;
}
Expand Down Expand Up @@ -331,7 +331,7 @@ protected List<RecentlyUsedEntityDTO> reorderWorkspacesInRecentlyUsedOrderForUse

// keeping the last maxSize ids, there may be a lot of ids which are not used anymore
if (srcIdList.size() > maxSize) {
srcIdList = srcIdList.subList(0, maxSize);
srcIdList.subList(maxSize, srcIdList.size()).clear();
}
return srcIdList;
}
Expand Down

0 comments on commit af69c69

Please sign in to comment.