mirror of https://github.com/sbt/sbt.git
Tweak assert messages in TermDisplay (#914)
This commit is contained in:
parent
9bc34e2e60
commit
d327418ed2
|
|
@ -162,9 +162,9 @@ object TermDisplay {
|
||||||
info: Info,
|
info: Info,
|
||||||
fallbackMessage: => String
|
fallbackMessage: => String
|
||||||
): Unit = {
|
): Unit = {
|
||||||
assert(!infos.containsKey(url))
|
assert(!infos.containsKey(url), s"Attempts to download $url twice in parallel")
|
||||||
val prev = infos.putIfAbsent(url, info)
|
val prev = infos.putIfAbsent(url, info)
|
||||||
assert(prev == null)
|
assert(prev == null, s"Attempts to download $url twice in parallel (second check)")
|
||||||
|
|
||||||
if (fallbackMode) {
|
if (fallbackMode) {
|
||||||
// FIXME What about concurrent accesses to out from the thread above?
|
// FIXME What about concurrent accesses to out from the thread above?
|
||||||
|
|
@ -190,7 +190,7 @@ object TermDisplay {
|
||||||
downloads -= url
|
downloads -= url
|
||||||
|
|
||||||
val info = infos.remove(url)
|
val info = infos.remove(url)
|
||||||
assert(info != null)
|
assert(info != null, s"$url was not being downloaded")
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
doneQueue += (url -> update0(info))
|
doneQueue += (url -> update0(info))
|
||||||
|
|
@ -439,7 +439,7 @@ class TermDisplay(
|
||||||
|
|
||||||
override def downloadLength(url: String, totalLength: Long, alreadyDownloaded: Long, watching: Boolean): Unit = {
|
override def downloadLength(url: String, totalLength: Long, alreadyDownloaded: Long, watching: Boolean): Unit = {
|
||||||
val info = updateRunnable.infos.get(url)
|
val info = updateRunnable.infos.get(url)
|
||||||
assert(info != null)
|
assert(info != null, s"Incoherent state ($url)")
|
||||||
val newInfo = info match {
|
val newInfo = info match {
|
||||||
case info0: DownloadInfo =>
|
case info0: DownloadInfo =>
|
||||||
info0.copy(
|
info0.copy(
|
||||||
|
|
@ -456,7 +456,7 @@ class TermDisplay(
|
||||||
}
|
}
|
||||||
override def downloadProgress(url: String, downloaded: Long): Unit = {
|
override def downloadProgress(url: String, downloaded: Long): Unit = {
|
||||||
val info = updateRunnable.infos.get(url)
|
val info = updateRunnable.infos.get(url)
|
||||||
assert(info != null)
|
assert(info != null, s"Incoherent state ($url)")
|
||||||
val newInfo = info match {
|
val newInfo = info match {
|
||||||
case info0: DownloadInfo =>
|
case info0: DownloadInfo =>
|
||||||
info0.copy(downloaded = downloaded)
|
info0.copy(downloaded = downloaded)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue