GsonHttpMessageConverter keeps output stream open (for SseEmitter)

Issue: SPR-16529
This commit is contained in:
Juergen Hoeller
2018-02-23 11:02:34 +01:00
parent 37ee264fbf
commit e83491fbe9

View File

@@ -48,7 +48,7 @@ import org.springframework.util.Assert;
* By default, it supports {@code application/json} and {@code application/*+json} with
* {@code UTF-8} character set.
*
* <p>Tested against Gson 2.6; compatible with Gson 2.0 and higher.
* <p>Tested against Gson 2.8; compatible with Gson 2.0 and higher.
*
* @author Roy Clarkson
* @since 4.1
@@ -196,7 +196,7 @@ public class GsonHttpMessageConverter extends AbstractGenericHttpMessageConverte
this.gson.toJson(o, writer);
}
writer.close();
writer.flush();
}
catch (JsonIOException ex) {
throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);