From a304d5bf28a2b0b139ef4161d74e5776278b1d57 Mon Sep 17 00:00:00 2001 From: Geoffroy Jabouley Date: Tue, 19 May 2020 14:56:31 +0200 Subject: [PATCH 1/2] JENKINS-50363 Silent the DoubleFromString conversion exception (INFO --> FINE) It is a feature not to configure YaxisMinimum/Maximum. In that case, String values are defaulted to null. As DoubleFromString convertion is called also within hasYaxisMinimum() / hasYaxisMaximum() function (strange pattern), so convertion failure is a feature and should not raise an exception with INFO level, which is bloating Jenkins logs --- src/main/java/hudson/plugins/plot/Plot.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/hudson/plugins/plot/Plot.java b/src/main/java/hudson/plugins/plot/Plot.java index 8837ebfe..7048e3ea 100644 --- a/src/main/java/hudson/plugins/plot/Plot.java +++ b/src/main/java/hudson/plugins/plot/Plot.java @@ -399,7 +399,7 @@ public Double getDoubleFromString(String input) { try { result = Double.parseDouble(input); } catch (NumberFormatException nfe) { - LOGGER.log(Level.INFO, "Failed to parse Double value from String." + LOGGER.log(Level.FINE, "Failed to parse Double value from String." + " Not a problem, result already set", nfe); } } From a40872ff053b58bd4e58a52bd8745e995ee32b96 Mon Sep 17 00:00:00 2001 From: Geoffroy Jabouley Date: Mon, 20 Jul 2020 17:11:07 +0200 Subject: [PATCH 2/2] JENKINS-50363 Properly checks for Xaxis/Yaxis emptiness Leveraging StringUtils.IsEmty() which handles null gracefully --- src/main/java/hudson/plugins/plot/Plot.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/hudson/plugins/plot/Plot.java b/src/main/java/hudson/plugins/plot/Plot.java index 7048e3ea..eaa603f9 100644 --- a/src/main/java/hudson/plugins/plot/Plot.java +++ b/src/main/java/hudson/plugins/plot/Plot.java @@ -395,11 +395,11 @@ public Double getYaxisMaximum() { public Double getDoubleFromString(String input) { Double result = null; - if (input != null) { + if (!StringUtils.isEmpty(input)) { try { result = Double.parseDouble(input); } catch (NumberFormatException nfe) { - LOGGER.log(Level.FINE, "Failed to parse Double value from String." + LOGGER.log(Level.INFO, "Failed to parse Double value from String." + " Not a problem, result already set", nfe); } }