Switch from snakeyaml to snakeyaml-engine (#5138)
* switch from snakeyaml to snakeyaml-engine * spotless
This commit is contained in:
parent
59043802e6
commit
8b01e78f42
|
@ -22,7 +22,7 @@ val DEPENDENCY_BOMS = listOf(
|
||||||
"io.zipkin.reporter2:zipkin-reporter-bom:2.16.3",
|
"io.zipkin.reporter2:zipkin-reporter-bom:2.16.3",
|
||||||
"org.junit:junit-bom:5.9.2",
|
"org.junit:junit-bom:5.9.2",
|
||||||
"org.testcontainers:testcontainers-bom:1.17.6",
|
"org.testcontainers:testcontainers-bom:1.17.6",
|
||||||
"org.yaml:snakeyaml:1.33"
|
"org.snakeyaml:snakeyaml-engine:2.6"
|
||||||
)
|
)
|
||||||
|
|
||||||
val autoValueVersion = "1.10.1"
|
val autoValueVersion = "1.10.1"
|
||||||
|
|
|
@ -20,7 +20,7 @@ dependencies {
|
||||||
|
|
||||||
// io.opentelemetry.sdk.extension.incubator.metric.viewconfig
|
// io.opentelemetry.sdk.extension.incubator.metric.viewconfig
|
||||||
implementation(project(":sdk-extensions:autoconfigure-spi"))
|
implementation(project(":sdk-extensions:autoconfigure-spi"))
|
||||||
implementation("org.yaml:snakeyaml")
|
implementation("org.snakeyaml:snakeyaml-engine")
|
||||||
|
|
||||||
// io.opentelemetry.sdk.extension.trace.zpages
|
// io.opentelemetry.sdk.extension.trace.zpages
|
||||||
implementation(project(":semconv"))
|
implementation(project(":semconv"))
|
||||||
|
|
|
@ -27,7 +27,8 @@ import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.snakeyaml.engine.v2.api.Load;
|
||||||
|
import org.snakeyaml.engine.v2.api.LoadSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables file based YAML configuration of Metric SDK {@link View}s.
|
* Enables file based YAML configuration of Metric SDK {@link View}s.
|
||||||
|
@ -94,10 +95,14 @@ public final class ViewConfig {
|
||||||
// Visible for testing
|
// Visible for testing
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
static List<ViewConfigSpecification> loadViewConfig(InputStream inputStream) {
|
static List<ViewConfigSpecification> loadViewConfig(InputStream inputStream) {
|
||||||
Yaml yaml = new Yaml();
|
LoadSettings settings = LoadSettings.builder().build();
|
||||||
|
Load yaml = new Load(settings);
|
||||||
try {
|
try {
|
||||||
List<ViewConfigSpecification> result = new ArrayList<>();
|
List<ViewConfigSpecification> result = new ArrayList<>();
|
||||||
List<Map<String, Object>> viewConfigs = yaml.load(inputStream);
|
|
||||||
|
List<Map<String, Object>> viewConfigs =
|
||||||
|
(List<Map<String, Object>>) yaml.loadFromInputStream(inputStream);
|
||||||
|
|
||||||
for (Map<String, Object> viewConfigSpecMap : viewConfigs) {
|
for (Map<String, Object> viewConfigSpecMap : viewConfigs) {
|
||||||
Map<String, Object> selectorSpecMap =
|
Map<String, Object> selectorSpecMap =
|
||||||
requireNonNull(
|
requireNonNull(
|
||||||
|
|
Loading…
Reference in New Issue