You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by if...@apache.org on 2020/09/22 09:43:49 UTC

[cassandra] branch trunk updated: Fix test failure caused by CASSANDRA-16102

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

ifesdjeen pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new fb49ab2  Fix test failure caused by CASSANDRA-16102
fb49ab2 is described below

commit fb49ab2b12bf813697971b41fe47ac11f4a240c0
Author: Alex Petrov <ol...@gmail.com>
AuthorDate: Sun Sep 20 13:24:22 2020 +0300

    Fix test failure caused by CASSANDRA-16102
    
    Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-16102
---
 .../apache/cassandra/config/YamlConfigurationLoader.java   | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
index 08dfd4c..ac9201c 100644
--- a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
+++ b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.config;
 
-import java.beans.IntrospectionException;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
@@ -45,6 +44,7 @@ import org.apache.cassandra.exceptions.ConfigurationException;
 import org.yaml.snakeyaml.TypeDescription;
 import org.yaml.snakeyaml.Yaml;
 import org.yaml.snakeyaml.constructor.Constructor;
+import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor;
 import org.yaml.snakeyaml.error.YAMLException;
 import org.yaml.snakeyaml.introspector.MissingProperty;
 import org.yaml.snakeyaml.introspector.Property;
@@ -119,7 +119,8 @@ public class YamlConfigurationLoader implements ConfigurationLoader
                 throw new AssertionError(e);
             }
 
-            Constructor constructor = new CustomConstructor(Config.class);
+
+            Constructor constructor = new CustomConstructor(Config.class, Yaml.class.getClassLoader());
             PropertiesChecker propertiesChecker = new PropertiesChecker();
             constructor.setPropertyUtils(propertiesChecker);
             Yaml yaml = new Yaml(constructor);
@@ -134,11 +135,11 @@ public class YamlConfigurationLoader implements ConfigurationLoader
         }
     }
 
-    static class CustomConstructor extends Constructor
+    static class CustomConstructor extends CustomClassLoaderConstructor
     {
-        CustomConstructor(Class<?> theRoot)
+        CustomConstructor(Class<?> theRoot, ClassLoader classLoader)
         {
-            super(theRoot);
+            super(theRoot, classLoader);
 
             TypeDescription seedDesc = new TypeDescription(ParameterizedClass.class);
             seedDesc.putMapPropertyType("parameters", String.class, String.class);
@@ -148,7 +149,6 @@ public class YamlConfigurationLoader implements ConfigurationLoader
         @Override
         protected List<Object> createDefaultList(int initSize)
         {
-
             return Lists.newCopyOnWriteArrayList();
         }
 
@@ -165,7 +165,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader
         }
     }
 
-    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


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