From 2698000a8570bc616f3361a519bf01b40f623fae Mon Sep 17 00:00:00 2001 From: exceptionfactory Date: Thu, 23 Mar 2023 16:01:23 -0500 Subject: [PATCH] NIFI-11254 Upgraded SnakeYAML from 1.33 to 2.0 - Updated MiNiFi and EasyRules references to use required arguments Signed-off-by: Pierre Villard This closes #7084. --- .../minifi/commons/schema/serialization/ConfigRepresenter.java | 2 ++ .../src/main/java/org/apache/nifi/rules/RulesFactory.java | 3 ++- pom.xml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/minifi/minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/serialization/ConfigRepresenter.java b/minifi/minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/serialization/ConfigRepresenter.java index 56da732860..6555ab2a57 100644 --- a/minifi/minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/serialization/ConfigRepresenter.java +++ b/minifi/minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/serialization/ConfigRepresenter.java @@ -17,11 +17,13 @@ package org.apache.nifi.minifi.commons.schema.serialization; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.representer.Representer; public class ConfigRepresenter extends Representer { public ConfigRepresenter() { + super(new DumperOptions()); nullRepresenter = data -> representScalar(Tag.NULL, ""); } } diff --git a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/main/java/org/apache/nifi/rules/RulesFactory.java b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/main/java/org/apache/nifi/rules/RulesFactory.java index 575dab90fa..1f1b7046d4 100644 --- a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/main/java/org/apache/nifi/rules/RulesFactory.java +++ b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/main/java/org/apache/nifi/rules/RulesFactory.java @@ -22,6 +22,7 @@ import org.jeasy.rules.support.reader.JsonRuleDefinitionReader; import org.jeasy.rules.support.RuleDefinition; import org.jeasy.rules.support.reader.RuleDefinitionReader; import org.jeasy.rules.support.reader.YamlRuleDefinitionReader; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; @@ -116,7 +117,7 @@ public class RulesFactory { private static List yamlToRules(InputStream rulesInputStream) throws FileNotFoundException { List rules = new ArrayList<>(); - Yaml yaml = new Yaml(new Constructor(Rule.class)); + Yaml yaml = new Yaml(new Constructor(Rule.class, new LoaderOptions())); for (Object object : yaml.loadAll(rulesInputStream)) { if (object instanceof Rule) { rules.add((Rule) object); diff --git a/pom.xml b/pom.xml index c97ebab9c6..8264cdde86 100644 --- a/pom.xml +++ b/pom.xml @@ -141,7 +141,7 @@ 1.3.5 4.11.0 3.10.6.Final - 1.33 + 2.0 4.1.90.Final 5.3.26 5.8.2