Skip to content

Commit d009dd2

Browse files
committed
GROOVY-11925: Improve consistency of TOML functionality (clean up resource closing)
1 parent 7a1b9cb commit d009dd2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

subprojects/groovy-toml/src/main/java/org/apache/groovy/toml/util/TomlConverter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public final class TomlConverter {
4040
* @return the text of json
4141
*/
4242
public static String convertTomlToJson(Reader tomlReader) {
43-
try (Reader reader = tomlReader) {
44-
Object yaml = new ObjectMapper(new TomlFactory()).readValue(reader, Object.class);
43+
try {
44+
Object toml = new ObjectMapper(new TomlFactory()).readValue(tomlReader, Object.class);
4545

46-
return new ObjectMapper().writeValueAsString(yaml);
46+
return new ObjectMapper().writeValueAsString(toml);
4747
} catch (IOException e) {
4848
throw new TomlRuntimeException(e);
4949
}
@@ -55,8 +55,8 @@ public static String convertTomlToJson(Reader tomlReader) {
5555
* @return the text of toml
5656
*/
5757
public static String convertJsonToToml(Reader jsonReader) {
58-
try (Reader reader = jsonReader) {
59-
JsonNode json = new ObjectMapper().readTree(reader);
58+
try {
59+
JsonNode json = new ObjectMapper().readTree(jsonReader);
6060

6161
return new TomlMapper().writeValueAsString(json);
6262
} catch (IOException e) {

0 commit comments

Comments
 (0)