From 8050bd9e7612f7e2e6faebda4773c206c097255d Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 25 Mar 2020 13:05:22 +0100 Subject: [PATCH] PerfdataValue#Parse(): don't complain on unknown UoMs refs #7225 --- lib/base/perfdatavalue.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/base/perfdatavalue.cpp b/lib/base/perfdatavalue.cpp index 422988d80..0d3c098a5 100644 --- a/lib/base/perfdatavalue.cpp +++ b/lib/base/perfdatavalue.cpp @@ -47,6 +47,10 @@ PerfdataValue::Ptr PerfdataValue::Parse(const String& perfdata) size_t pos = valueStr.FindFirstNotOf("+-0123456789.e"); + if (pos != String::NPos && valueStr[pos] == ',') { + BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid performance data value: " + perfdata)); + } + double value = Convert::ToDouble(valueStr.SubStr(0, pos)); std::vector tokens = valueStr.Split(";"); @@ -90,7 +94,10 @@ PerfdataValue::Ptr PerfdataValue::Parse(const String& perfdata) counter = true; unit = ""; } else if (unit != "") { - BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid performance data unit: " + unit)); + Log(LogDebug, "PerfdataValue") + << "Invalid performance data unit: " << unit; + + unit = ""; } warn = ParseWarnCritMinMaxToken(tokens, 1, "warning");