-
-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix StackOverflowError when merging ParseObject from JSON (#925)
* Add test for StackOverflowError during mergeFromServer This test shows the #896 bug. * Make a synchronized copy of availableKeys `synchronizedSet(s)` ends up making a new wrapper for the supplied set, which means on subsequent calls, it becomes a SynchronizedSet, wrapped in a SynchronizedSet, wrapped ... etc. When using the LocalDataStore, the ParseObject.State is reused for every matching ClassName+ObjectId pair, so every time a ParseObject is parsed from JSON data, the existing object is "refreshed" by making a copy of its State, and then merging with the new data. Every call to State.newBuilder() is therefore adding a new layer of SynchronizedSet to the availableKeys Set. Eventually that nested hierarchy of sets becomes so large that it causes a StackOverflowError for any operation on the collection. By making a copy of the set before wrapping it in synchronizedSet(), that nested hierarchy becomes severed, and we end up with just one level of wrappers. * Accept the updated Android Build-Tools 27 license
- Loading branch information
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters