Tweak assert messages in TermDisplay (#914)

This commit is contained in:
Alexandre Archambault 2018-09-28 15:56:13 +02:00 committed by GitHub
parent 9bc34e2e60
commit d327418ed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -162,9 +162,9 @@ object TermDisplay {
info: Info,
fallbackMessage: => String
): Unit = {
assert(!infos.containsKey(url))
assert(!infos.containsKey(url), s"Attempts to download $url twice in parallel")
val prev = infos.putIfAbsent(url, info)
assert(prev == null)
assert(prev == null, s"Attempts to download $url twice in parallel (second check)")
if (fallbackMode) {
// FIXME What about concurrent accesses to out from the thread above?
@ -190,7 +190,7 @@ object TermDisplay {
downloads -= url
val info = infos.remove(url)
assert(info != null)
assert(info != null, s"$url was not being downloaded")
if (success)
doneQueue += (url -> update0(info))
@ -439,7 +439,7 @@ class TermDisplay(
override def downloadLength(url: String, totalLength: Long, alreadyDownloaded: Long, watching: Boolean): Unit = {
val info = updateRunnable.infos.get(url)
assert(info != null)
assert(info != null, s"Incoherent state ($url)")
val newInfo = info match {
case info0: DownloadInfo =>
info0.copy(
@ -456,7 +456,7 @@ class TermDisplay(
}
override def downloadProgress(url: String, downloaded: Long): Unit = {
val info = updateRunnable.infos.get(url)
assert(info != null)
assert(info != null, s"Incoherent state ($url)")
val newInfo = info match {
case info0: DownloadInfo =>
info0.copy(downloaded = downloaded)