Skip to content

Commit 2808816

Browse files
jbescoslukasj
authored andcommitted
What is the contract for of JsonGenerator#close() on error? #156
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
1 parent a80b0be commit 2808816

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/src/main/java/jakarta/json/stream/JsonGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,10 @@ public interface JsonGenerator extends Flushable, /*Auto*/Closeable {
518518
* Closes this generator and frees any resources associated with it.
519519
* This method closes the underlying output source.
520520
*
521+
* The underlying stream is closed only if complete JSON object is written. In case
522+
* of incomplete object JsonGenerationException is thrown and underlying stream is
523+
* not closed.
524+
*
521525
* @throws jakarta.json.JsonException if an i/o error occurs (IOException
522526
* would be cause of JsonException)
523527
* @throws JsonGenerationException if an incomplete JSON is generated

0 commit comments

Comments
 (0)