You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2021/10/15 15:07:58 UTC

[cassandra] branch cassandra-3.11 updated: Upgrade to snakeyaml 1.26

This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-3.11 by this push:
     new 5c7603c  Upgrade to snakeyaml 1.26
5c7603c is described below

commit 5c7603c2aed261380e364f5f50933db11038dbb0
Author: Brandon Williams <br...@apache.org>
AuthorDate: Fri Oct 8 12:01:40 2021 -0500

    Upgrade to snakeyaml 1.26
    
    Patch by brandonwilliams; reviewed by bereng for CASSANDRA-17028
---
 CHANGES.txt                                        |  1 +
 build.xml                                          |  2 +-
 .../cassandra/config/YamlConfigurationLoader.java  | 30 ++++++++++++++--------
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 3f0957c..8460705 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.11.12
+ * Upgrade snakeyaml to 1.26 in 3.11 (CASSANDRA=17028)
  * Add key validation to ssstablescrub (CASSANDRA-16969)
  * Update Jackson from 2.9.10 to 2.12.5 (CASSANDRA-16851)
  * Include SASI components to snapshots (CASSANDRA-15134)
diff --git a/build.xml b/build.xml
index fe77098..f2b60eb 100644
--- a/build.xml
+++ b/build.xml
@@ -360,7 +360,7 @@
             <exclusion groupId="org.slf4j" artifactId="slf4j-log4j12"/>
             <exclusion groupId="junit" artifactId="junit"/>
           </dependency>
-          <dependency groupId="org.yaml" artifactId="snakeyaml" version="1.11"/>
+          <dependency groupId="org.yaml" artifactId="snakeyaml" version="1.26"/>
           <dependency groupId="org.apache.thrift" artifactId="libthrift" version="0.9.2">
 	         <exclusion groupId="commons-logging" artifactId="commons-logging"/>
 	         <exclusion groupId="org.apache.httpcomponents" artifactId="httpclient"/>
diff --git a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
index 1dedb29..e193080 100644
--- a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
+++ b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
@@ -17,12 +17,13 @@
  */
 package org.apache.cassandra.config;
 
-import java.beans.IntrospectionException;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.annotation.Annotation;
 import java.net.URL;
+import java.util.Collections;
 import java.util.HashSet;
 
 import java.util.List;
@@ -120,7 +121,8 @@ public class YamlConfigurationLoader implements ConfigurationLoader
                 throw new AssertionError(e);
             }
 
-            Constructor constructor = new CustomConstructor(Config.class, Config.class.getClassLoader());
+
+            Constructor constructor = new CustomConstructor(Config.class, Yaml.class.getClassLoader());
             PropertiesChecker propertiesChecker = new PropertiesChecker();
             constructor.setPropertyUtils(propertiesChecker);
             Yaml yaml = new Yaml(constructor);
@@ -180,7 +182,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader
         }
 
         @Override
-        protected Map<Object, Object> createDefaultMap()
+        protected Map<Object, Object> createDefaultMap(int initSize)
         {
             return Maps.newConcurrentMap();
         }
@@ -190,15 +192,9 @@ public class YamlConfigurationLoader implements ConfigurationLoader
         {
             return Sets.newConcurrentHashSet();
         }
-
-        @Override
-        protected Set<Object> createDefaultSet()
-        {
-            return Sets.newConcurrentHashSet();
-        }
     }
 
-    private Config loadConfig(Yaml yaml, byte[] configBytes)
+    private static Config loadConfig(Yaml yaml, byte[] configBytes)
     {
         Config config = yaml.loadAs(new ByteArrayInputStream(configBytes), Config.class);
         // If the configuration file is empty yaml will return null. In this case we should use the default
@@ -222,7 +218,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader
         }
 
         @Override
-        public Property getProperty(Class<? extends Object> type, String name) throws IntrospectionException
+        public Property getProperty(Class<? extends Object> type, String name)
         {
             final Property result = super.getProperty(type, name);
 
@@ -254,6 +250,18 @@ public class YamlConfigurationLoader implements ConfigurationLoader
                 {
                     return result.get(object);
                 }
+
+                @Override
+                public List<Annotation> getAnnotations()
+                {
+                    return Collections.EMPTY_LIST;
+                }
+
+                @Override
+                public <A extends Annotation> A getAnnotation(Class<A> aClass)
+                {
+                    return null;
+                }
             };
         }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org