diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-03-29 10:01:24 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-03-29 10:01:24 +1000 |
commit | d40f1b81372e1cdb101790d14c5bc8c7c304c128 (patch) | |
tree | 50eeb15e70e9714bcdf18940969d376c84009fe5 /src | |
parent | ca606e6943c405e487c54c3fd14a3a8ac917bb2e (diff) | |
download | scala-d40f1b81372e1cdb101790d14c5bc8c7c304c128.tar.gz scala-d40f1b81372e1cdb101790d14c5bc8c7c304c128.tar.bz2 scala-d40f1b81372e1cdb101790d14c5bc8c7c304c128.zip |
SI-7474 Record extra errors in Throwable#suppressedExceptions
... in parallel collection operations.
Followup to bcbe38d18, which did away with the the approach to
use a composite exception when more than one error happened.
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/collection/parallel/Tasks.scala | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/library/scala/collection/parallel/Tasks.scala b/src/library/scala/collection/parallel/Tasks.scala index c9a75752df..2a4e40dd16 100644 --- a/src/library/scala/collection/parallel/Tasks.scala +++ b/src/library/scala/collection/parallel/Tasks.scala @@ -66,13 +66,10 @@ trait Task[R, +Tp] { } private[parallel] def mergeThrowables(that: Task[_, _]) { - // TODO: As soon as we target Java >= 7, use Throwable#addSuppressed - // to pass additional Throwables to the caller, e. g. - // if (this.throwable != null && that.throwable != null) - // this.throwable.addSuppressed(that.throwable) - // For now, we just use whatever Throwable comes across “first”. - if (this.throwable == null && that.throwable != null) - this.throwable = that.throwable + if (this.throwable != null && that.throwable != null) + this.throwable.addSuppressed(that.throwable) + else if (this.throwable == null && that.throwable != null) + this.throwable = that.throwable } // override in concrete task implementations to signal abort to other tasks |