You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/06/08 06:47:56 UTC
[groovy] branch master updated: Trivial refactoring: inline variable
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 8ea882a Trivial refactoring: inline variable
8ea882a is described below
commit 8ea882a587ce3183c95ea1bc19dfc44367dc292e
Author: Daniel Sun <su...@apache.org>
AuthorDate: Tue Jun 8 14:47:44 2021 +0800
Trivial refactoring: inline variable
---
.../src/main/java/org/apache/groovy/yaml/util/YamlConverter.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/subprojects/groovy-yaml/src/main/java/org/apache/groovy/yaml/util/YamlConverter.java b/subprojects/groovy-yaml/src/main/java/org/apache/groovy/yaml/util/YamlConverter.java
index 988f63c..72a91b4 100644
--- a/subprojects/groovy-yaml/src/main/java/org/apache/groovy/yaml/util/YamlConverter.java
+++ b/subprojects/groovy-yaml/src/main/java/org/apache/groovy/yaml/util/YamlConverter.java
@@ -40,10 +40,9 @@ public class YamlConverter {
*/
public static String convertYamlToJson(Reader yamlReader) {
try (Reader reader = yamlReader) {
- final YAMLFactory yamlFactory = new YAMLFactory();
List<Object> resultList =
new ObjectMapper()
- .readValues(yamlFactory.createParser(reader), Object.class)
+ .readValues(new YAMLFactory().createParser(reader), Object.class)
.readAll();
Object yaml = 1 == resultList.size() ? resultList.get(0) : resultList;
return new ObjectMapper().writeValueAsString(yaml);