diff --git a/.build/parent-pom-template.xml b/.build/parent-pom-template.xml index c2b23a4ca9..6e12bf0129 100644 --- a/.build/parent-pom-template.xml +++ b/.build/parent-pom-template.xml @@ -427,27 +427,27 @@ com.fasterxml.jackson.core jackson-core - 2.15.3 + 2.13.2 com.fasterxml.jackson.core jackson-databind - 2.15.3 + 2.13.2.2 com.fasterxml.jackson.core jackson-annotations - 2.15.3 + 2.13.2 com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.15.3 + 2.13.2 com.fasterxml.jackson.dataformat jackson-dataformat-yaml - 2.15.3 + 2.13.2 test @@ -469,7 +469,7 @@ org.yaml snakeyaml - 2.1 + 1.26 junit diff --git a/CHANGES.txt b/CHANGES.txt index a8c465c72a..1e690b42cb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,5 @@ 5.1 * Make nodetool tablestats use number of significant digits for time and average values consistently (CASSANDRA-19015) - * Upgrade jackson to 2.15.3 and snakeyaml to 2.1 (CASSANDRA-18875) * Transactional Cluster Metadata [CEP-21] (CASSANDRA-18330) * Add ELAPSED command to cqlsh (CASSANDRA-18861) * Add the ability to disable bulk loading of SSTables (CASSANDRA-18781) diff --git a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java index a312aa47dd..edff7be8ec 100644 --- a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java +++ b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java @@ -52,8 +52,6 @@ import org.yaml.snakeyaml.introspector.MissingProperty; import org.yaml.snakeyaml.introspector.Property; import org.yaml.snakeyaml.introspector.PropertyUtils; import org.yaml.snakeyaml.nodes.Node; -import org.yaml.snakeyaml.parser.ParserImpl; -import org.yaml.snakeyaml.resolver.Resolver; import static org.apache.cassandra.config.CassandraRelevantProperties.ALLOW_DUPLICATE_CONFIG_KEYS; import static org.apache.cassandra.config.CassandraRelevantProperties.ALLOW_NEW_OLD_CONFIG_KEYS; @@ -197,7 +195,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader private static void verifyReplacements(Map, Map> replacements, byte[] configBytes) { - LoaderOptions loaderOptions = getDefaultLoaderOptions(); + LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.setAllowDuplicateKeys(ALLOW_DUPLICATE_CONFIG_KEYS.getBoolean()); Yaml rawYaml = new Yaml(loaderOptions); @@ -224,7 +222,14 @@ public class YamlConfigurationLoader implements ConfigurationLoader constructor.setPropertyUtils(propertiesChecker); Yaml yaml = new Yaml(constructor); Node node = yaml.represent(map); - constructor.setComposer(getDefaultComposer(node)); + constructor.setComposer(new Composer(null, null) + { + @Override + public Node getSingleNode() + { + return node; + } + }); T value = (T) constructor.getSingleData(klass); if (shouldCheck) propertiesChecker.check(); @@ -251,23 +256,18 @@ public class YamlConfigurationLoader implements ConfigurationLoader constructor.setPropertyUtils(propertiesChecker); Yaml yaml = new Yaml(constructor); Node node = yaml.represent(map); - constructor.setComposer(getDefaultComposer(node)); - T value = (T) constructor.getSingleData(klass); - if (shouldCheck) - propertiesChecker.check(); - return value; - } - - private static Composer getDefaultComposer(Node node) - { - return new Composer(new ParserImpl(null), new Resolver(), getDefaultLoaderOptions()) + constructor.setComposer(new Composer(null, null) { @Override public Node getSingleNode() { return node; } - }; + }); + T value = (T) constructor.getSingleData(klass); + if (shouldCheck) + propertiesChecker.check(); + return value; } @VisibleForTesting @@ -275,7 +275,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader { CustomConstructor(Class theRoot, ClassLoader classLoader) { - super(theRoot, classLoader, getDefaultLoaderOptions()); + super(theRoot, classLoader); TypeDescription seedDesc = new TypeDescription(ParameterizedClass.class); seedDesc.putMapPropertyType("parameters", String.class, String.class); @@ -426,12 +426,5 @@ public class YamlConfigurationLoader implements ConfigurationLoader logger.warn("{} parameters have been deprecated. They have new names and/or value format; For more information, please refer to NEWS.txt", deprecationWarnings); } } - - public static LoaderOptions getDefaultLoaderOptions() - { - LoaderOptions loaderOptions = new LoaderOptions(); - loaderOptions.setCodePointLimit(64 * 1024 * 1024); // 64 MiB - return loaderOptions; - } } diff --git a/src/java/org/apache/cassandra/tools/JMXTool.java b/src/java/org/apache/cassandra/tools/JMXTool.java index 3e2fab5b3b..8cf5748a2e 100644 --- a/src/java/org/apache/cassandra/tools/JMXTool.java +++ b/src/java/org/apache/cassandra/tools/JMXTool.java @@ -68,11 +68,9 @@ import io.airlift.airline.Command; import io.airlift.airline.Help; import io.airlift.airline.HelpOption; import io.airlift.airline.Option; -import org.apache.cassandra.config.YamlConfigurationLoader; import org.apache.cassandra.io.util.File; import org.apache.cassandra.io.util.FileInputStreamPlus; import org.apache.cassandra.utils.JsonUtils; -import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; @@ -165,7 +163,7 @@ public class JMXTool { void dump(OutputStream output, Map map) throws IOException { - Representer representer = new Representer(new DumperOptions()); + Representer representer = new Representer(); representer.addClassTag(Info.class, Tag.MAP); // avoid the auto added tag Yaml yaml = new Yaml(representer); yaml.dump(map, new OutputStreamWriter(output)); @@ -396,7 +394,6 @@ public class JMXTool public CustomConstructor() { - super(YamlConfigurationLoader.getDefaultLoaderOptions()); this.rootTag = new Tag(ROOT); this.addTypeDescription(INFO_TYPE); } diff --git a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java index 598a4f327a..cc668b5ad4 100644 --- a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java +++ b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java @@ -37,7 +37,6 @@ import com.google.common.util.concurrent.Uninterruptibles; import com.datastax.driver.core.*; import com.datastax.driver.core.exceptions.AlreadyExistsException; import org.antlr.runtime.RecognitionException; -import org.apache.cassandra.config.YamlConfigurationLoader; import org.apache.cassandra.cql3.CQLFragmentParser; import org.apache.cassandra.cql3.CqlParser; import org.apache.cassandra.cql3.statements.ModificationStatement; @@ -810,7 +809,7 @@ public class StressProfile implements Serializable { try { - Constructor constructor = new Constructor(StressYaml.class, YamlConfigurationLoader.getDefaultLoaderOptions()); + Constructor constructor = new Constructor(StressYaml.class); Yaml yaml = new Yaml(constructor);