diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-02-02 18:49:14 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-02-05 21:52:04 +0100 |
commit | 937824b05e114fa21af572e24e36eeeda29842ef (patch) | |
tree | 689890784c603bd8d756280e0d75916f07d031cb /sonar-core/src | |
parent | 2c0f324f86c3c6b2e7eb45f363f12e0fa511541f (diff) | |
download | sonarqube-937824b05e114fa21af572e24e36eeeda29842ef.tar.gz sonarqube-937824b05e114fa21af572e24e36eeeda29842ef.zip |
Improve doc and usages of JsonWriter
Diffstat (limited to 'sonar-core/src')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/util/ProtobufJsonFormat.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/util/ProtobufJsonFormat.java b/sonar-core/src/main/java/org/sonar/core/util/ProtobufJsonFormat.java index f681116279f..546c6810c09 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/ProtobufJsonFormat.java +++ b/sonar-core/src/main/java/org/sonar/core/util/ProtobufJsonFormat.java @@ -161,8 +161,9 @@ public class ProtobufJsonFormat { public static String toJson(Message message) { StringWriter json = new StringWriter(); - JsonWriter jsonWriter = JsonWriter.of(json); - write(message, jsonWriter); + try (JsonWriter jsonWriter = JsonWriter.of(json)) { + write(message, jsonWriter); + } return json.toString(); } |