From 8d95c38e39b4cbe5b234469caea17949718f2ca4 Mon Sep 17 00:00:00 2001 From: David Vo Date: Tue, 25 Dec 2018 18:12:44 +1100 Subject: [PATCH] Watchdog: Fix potential IllegalFormatException (#1508) If an epoch name contains a % symbol, this could've lead to an exception at runtime where the number of arguments mismatches the format string. --- wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java index 7397286561..1a6af68511 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java @@ -155,7 +155,7 @@ public class Watchdog implements Closeable, Comparable { if (now - m_lastEpochsPrintTime > kMinPrintPeriod) { m_lastEpochsPrintTime = now; m_epochs.forEach((key, value) -> { - System.out.format("\t" + key + ": %.6fs\n", value / 1.0e6); + System.out.format("\t%s: %.6fs\n", key, value / 1.0e6); }); } }