From ce808c6eb128aee2cd5aea51180bb774a25d2f03 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 12 Dec 2024 11:29:09 +0100 Subject: [PATCH] Rename FailedCriterion message field to description Signed-off-by: lisrte --- .../com/powsybl/dynaflow/results/FailedCriterion.java | 4 ++-- .../java/com/powsybl/dynaflow/results/ResultsUtil.java | 8 ++++---- .../powsybl/dynaflow/results/XmlScenarioResultParser.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dynaflow/src/main/java/com/powsybl/dynaflow/results/FailedCriterion.java b/dynaflow/src/main/java/com/powsybl/dynaflow/results/FailedCriterion.java index 12027f1cb..8e2ddd47d 100644 --- a/dynaflow/src/main/java/com/powsybl/dynaflow/results/FailedCriterion.java +++ b/dynaflow/src/main/java/com/powsybl/dynaflow/results/FailedCriterion.java @@ -9,9 +9,9 @@ /** * scenarioResults or loadIncreaseResults failed criterion - * @param message Failed criterion message + * @param description Failed criterion description * @param time Failure time (in seconds) * @author Laurent Issertial {@literal } */ -public record FailedCriterion(String message, double time) { +public record FailedCriterion(String description, double time) { } diff --git a/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java b/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java index cfac54c62..8840f8e8d 100644 --- a/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java +++ b/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java @@ -57,13 +57,13 @@ static Optional createScenarioResult(String id, String status, L return Optional.empty(); } - static Optional createFailedCriterion(String message, String time) { - if (message == null || time == null) { - LOGGER.warn("Inconsistent failed criterion entry (message: '{}', time: '{}')", message, time); + static Optional createFailedCriterion(String description, String time) { + if (description == null || time == null) { + LOGGER.warn("Inconsistent failed criterion entry (description: '{}', time: '{}')", description, time); } else { try { double timeD = Double.parseDouble(time); - return Optional.of(new FailedCriterion(message, timeD)); + return Optional.of(new FailedCriterion(description, timeD)); } catch (NumberFormatException e) { logInconsistentEntry("time", time); } diff --git a/dynaflow/src/main/java/com/powsybl/dynaflow/results/XmlScenarioResultParser.java b/dynaflow/src/main/java/com/powsybl/dynaflow/results/XmlScenarioResultParser.java index 2f9428938..5d21cddd0 100644 --- a/dynaflow/src/main/java/com/powsybl/dynaflow/results/XmlScenarioResultParser.java +++ b/dynaflow/src/main/java/com/powsybl/dynaflow/results/XmlScenarioResultParser.java @@ -49,10 +49,10 @@ public static void readScenarioResult(String elementName, XMLStreamReader xmlRea public static void readFailedCriterion(String elementName, XMLStreamReader xmlReader, Consumer resultConsumer) { try { if (elementName.equals("criterionNonRespected")) { - String message = xmlReader.getAttributeValue(null, ID); + String description = xmlReader.getAttributeValue(null, ID); String time = xmlReader.getAttributeValue(null, TIME); XmlUtil.readEndElementOrThrow(xmlReader); - ResultsUtil.createFailedCriterion(message, time).ifPresent(resultConsumer); + ResultsUtil.createFailedCriterion(description, time).ifPresent(resultConsumer); } } catch (XMLStreamException e) { throw new UncheckedXmlStreamException(e);