Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update snakeyaml version #2523

Merged
merged 3 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.pytorch.serve.archive.DownloadArchiveException;
import org.pytorch.serve.archive.model.InvalidModelException;
import org.pytorch.serve.archive.s3.HttpUtils;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.error.YAMLException;
Expand All @@ -47,7 +48,7 @@ public static <T> T readFile(File file, Class<T> type)

public static <T> T readYamlFile(File file, Class<T> type)
throws InvalidModelException, IOException {
Yaml yaml = new Yaml(new Constructor(type));
Yaml yaml = new Yaml(new Constructor(type, new LoaderOptions()));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try (Reader r =
new InputStreamReader(
Files.newInputStream(file.toPath()), StandardCharsets.UTF_8)) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slf4j_api_version=1.7.32
slf4j_log4j_version=2.17.1
testng_version=7.1.0
torchserve_sdk_version=0.0.5
snakeyaml_version=1.31
snakeyaml_version=2.1
grpc_version=1.50.0
protoc_version=3.18.0
lmax_disruptor_version=3.4.4
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.composer.ComposerException;
import org.yaml.snakeyaml.constructor.Constructor;
Expand Down Expand Up @@ -64,7 +65,7 @@ public void validate() {

public static MetricConfiguration loadConfiguration(String configFilePath)
throws FileNotFoundException, ComposerException, RuntimeException {
Constructor constructor = new Constructor(MetricConfiguration.class);
Constructor constructor = new Constructor(MetricConfiguration.class, new LoaderOptions());
Yaml yaml = new Yaml(constructor);
FileInputStream inputStream = new FileInputStream(new File(configFilePath));
MetricConfiguration config = yaml.load(inputStream);
Expand Down