Skip to content

Commit

Permalink
Prevent empty snake yaml constructor, fixes #2153
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Dockal <odockal@redhat.com>
  • Loading branch information
odockal committed Feb 16, 2022
1 parent 986c8e9 commit fd6d8b7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.reddeer.junit.requirement.configuration.RequirementConfiguration;
import org.json.JSONObject;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
Expand Down Expand Up @@ -85,7 +86,7 @@ public List<RequirementConfiguration> loadConfigurations(File file) {

@SuppressWarnings("unchecked")
private String convertYamlToJson(File file) throws FileNotFoundException {
Map<String,Object> map= (Map<String, Object>) new Yaml().load(new FileReader(file));
Map<String,Object> map= (Map<String, Object>) new Yaml(new SafeConstructor()).load(new FileReader(file));
JSONObject jsonObject = new JSONObject(map);
return jsonObject.toString();
}
Expand Down

0 comments on commit fd6d8b7

Please sign in to comment.