no effective code change: add some try-with resources (#978)

* no effective code change: add some try-with resources

* moved return statement outside try-with-resources, because otherwise the order changes
This commit is contained in:
Roland Praml authored and Rob Bygrave committed 2017-02-24 12:52:22 +13:00
1 parent a315c7c11e
commit ca777d7967
12 files changed
+34 -54

No files matched your search

@@ -303,15 +303,13 @@ public class DJsonContext implements JsonContext {
}
private String toJsonString(Object value, JsonWriteOptions options) throws JsonIOException {
try {
StringWriter writer = new StringWriter(500);
JsonGenerator gen = createGenerator(writer);
StringWriter writer = new StringWriter(500);
try (JsonGenerator gen = createGenerator(writer)){
toJsonInternal(value, gen, options);
gen.close();
return writer.toString();
} catch (IOException e) {
throw new JsonIOException(e);
}
return writer.toString();
}
@SuppressWarnings("unchecked")