-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix broken implementation of ParTaskImpl::tasksFromIterable (#347)
The `tasksFromIterable` method in `ParTaskImpl` needs to read the contents of an iterator and then create an array of the read tasks. This is an unfortunate performance/memory tradeoff of using these two things: iterators don't have a length and arrays need one. The implementation reads the iterator's contents into a collection and then turns that collection into an array. The problem is, it then tries to cast that array of `Object` into a more narrow type, which is not allowed. This _always_ results in a ClassCastException if the value is non null. The exists tests did not cover this case. The code has been fixed to take a less performant path and delegate the array creation to `tasksFromCollection`. A test has been written for the `Iterable` code path and verified through coverage analysis.
- Loading branch information
1 parent
53ba29d
commit f6ab57d
Showing
2 changed files
with
49 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