NIFI-11254 Upgraded SnakeYAML from 1.33 to 2.0

- Updated MiNiFi and EasyRules references to use required arguments

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #7084.
This commit is contained in:
exceptionfactory 2023-03-23 16:01:23 -05:00 committed by Pierre Villard
parent b50c8101cf
commit 2698000a85
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
3 changed files with 5 additions and 2 deletions

View File

@ -17,11 +17,13 @@
package org.apache.nifi.minifi.commons.schema.serialization; package org.apache.nifi.minifi.commons.schema.serialization;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.representer.Representer; import org.yaml.snakeyaml.representer.Representer;
public class ConfigRepresenter extends Representer { public class ConfigRepresenter extends Representer {
public ConfigRepresenter() { public ConfigRepresenter() {
super(new DumperOptions());
nullRepresenter = data -> representScalar(Tag.NULL, ""); nullRepresenter = data -> representScalar(Tag.NULL, "");
} }
} }

View File

@ -22,6 +22,7 @@ import org.jeasy.rules.support.reader.JsonRuleDefinitionReader;
import org.jeasy.rules.support.RuleDefinition; import org.jeasy.rules.support.RuleDefinition;
import org.jeasy.rules.support.reader.RuleDefinitionReader; import org.jeasy.rules.support.reader.RuleDefinitionReader;
import org.jeasy.rules.support.reader.YamlRuleDefinitionReader; import org.jeasy.rules.support.reader.YamlRuleDefinitionReader;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.constructor.Constructor;
@ -116,7 +117,7 @@ public class RulesFactory {
private static List<Rule> yamlToRules(InputStream rulesInputStream) throws FileNotFoundException { private static List<Rule> yamlToRules(InputStream rulesInputStream) throws FileNotFoundException {
List<Rule> rules = new ArrayList<>(); List<Rule> 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)) { for (Object object : yaml.loadAll(rulesInputStream)) {
if (object instanceof Rule) { if (object instanceof Rule) {
rules.add((Rule) object); rules.add((Rule) object);

View File

@ -141,7 +141,7 @@
<logback.version>1.3.5</logback.version> <logback.version>1.3.5</logback.version>
<mockito.version>4.11.0</mockito.version> <mockito.version>4.11.0</mockito.version>
<netty.3.version>3.10.6.Final</netty.3.version> <netty.3.version>3.10.6.Final</netty.3.version>
<snakeyaml.version>1.33</snakeyaml.version> <snakeyaml.version>2.0</snakeyaml.version>
<netty.4.version>4.1.90.Final</netty.4.version> <netty.4.version>4.1.90.Final</netty.4.version>
<spring.version>5.3.26</spring.version> <spring.version>5.3.26</spring.version>
<spring.security.version>5.8.2</spring.security.version> <spring.security.version>5.8.2</spring.security.version>