From c174b9c9923b4dbdb247d0dc2fc286d90bdb4198 Mon Sep 17 00:00:00 2001 From: Kate Botsman Date: Thu, 21 Nov 2024 12:40:17 +0100 Subject: [PATCH] IJPL-166399 Coerce progress fraction to range 0.0-1.0 in the bridge indicator `ProgressIndicator` doesn't have a fraction check (although documentation states that the value should be in the range), so some progresses reported the wrong values without noticing that there is a problem. Now these indicators are converted to new `RawProgressReporter` there might be error spam in some cases, because the reporter checks that value is in the range. As this is a bridge between old and new functionality and `ProgressIndicator` is obsolete, it's better to prevent these errors from happening by adding the check to the bridge itself rather by fixing every place separately. GitOrigin-RevId: eae5f1c6caa3b21c43342cdba61fac12c0ed99d6 --- .../com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.kt b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.kt index dd0ac991062c..3a384e91771f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.kt +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.kt @@ -530,7 +530,10 @@ open class IdeStatusBarImpl @ApiStatus.Internal constructor( override fun setFraction(fraction: Double) { super.setFraction(fraction) - reporter.fraction(fraction) + // RawProgressReporter logs an error if the value is not in the interval 0.0-1.0, + // but ProgressIndicator didn't have that check before (although, according to the documentation, it should be in the range), + // so some indicators report the wrong value and this can cause error spam - IJPL-166399 + reporter.fraction(fraction.coerceIn(0.0, 1.0)) } } }