Skip to content

Commit

Permalink
Update to snakeyml 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Mar 20, 2023
1 parent a11c075 commit 8e0b2b5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.vertx.core.impl.ContextInternal;
import io.vertx.core.json.DecodeException;
import io.vertx.core.json.JsonObject;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

Expand All @@ -38,6 +39,8 @@
*/
public class YamlProcessor implements ConfigProcessor {

private static final LoaderOptions DEFAULT_OPTIONS = new LoaderOptions();

@Override
public String name() {
return "yaml";
Expand All @@ -53,7 +56,7 @@ public Future<JsonObject> process(Vertx vertx, JsonObject configuration, Buffer
// Use executeBlocking even if the bytes are in memory
return vertx.executeBlocking(promise -> {
try {
final Yaml yamlMapper = new Yaml(new SafeConstructor());
final Yaml yamlMapper = new Yaml(new SafeConstructor(DEFAULT_OPTIONS));
Map<Object, Object> doc = yamlMapper.load(input.toString(StandardCharsets.UTF_8));
promise.complete(jsonify(doc));
} catch (ClassCastException e) {
Expand Down

0 comments on commit 8e0b2b5

Please sign in to comment.