File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/test/java/com/fasterxml/jackson/core/read Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 16
16
class ParserClosingTest
17
17
extends JUnit5TestBase
18
18
{
19
+ // [core#1438]: clear _currToken on parser.close()
20
+ @ Test
21
+ void clearTokenOnClose () throws Exception
22
+ {
23
+ _clearTokenOnClose (MODE_INPUT_STREAM );
24
+ _clearTokenOnClose (MODE_INPUT_STREAM_THROTTLED );
25
+ _clearTokenOnClose (MODE_READER );
26
+ _clearTokenOnClose (MODE_DATA_INPUT );
27
+
28
+ }
29
+
30
+ private void _clearTokenOnClose (int mode ) throws Exception
31
+ {
32
+ try (JsonParser p = createParser (mode , "[1, 2]" )) {
33
+ assertNull (p .currentToken ());
34
+ assertToken (JsonToken .START_ARRAY , p .nextToken ());
35
+ p .close ();
36
+ assertNull (p .currentToken ());
37
+ }
38
+ }
39
+
19
40
/**
20
41
* This unit test checks the default behaviour; with no auto-close, no
21
42
* automatic closing should occur, nor explicit one unless specific
You can’t perform that action at this time.
0 commit comments