Skip to content

Commit 24edc02

Browse files
committed
Fix #83 (as shown by #143 but diff branch)
1 parent f5bf7a4 commit 24edc02

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

release-notes/CREDITS-2.x

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,11 @@ Guillaume Smaha (GuillaumeSmaha@github)
7171
Filip Hrisafov (filiphr@github)
7272
* Suggested #139: Support for Map<String, String> in `JavaPropsMapper`
7373
(2.10.0)
74-
74+
75+
Matti Bickel (wundrian@github)
76+
* Reported #83: Update index of sequence context
77+
(2.10.0)
78+
79+
Maarten Winkels (mwinkels@github)
80+
* Contributed fix for #83: Update index of sequence context
81+
(2.10.0)

release-notes/VERSION-2.x

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Modules:
88
=== Releases ===
99
------------------------------------------------------------------------
1010

11+
2.10.0 (not yet released)
12+
13+
#83: (yaml) Update index of sequence context
14+
(reported by Matti B; fix contributed by Maarten W)
15+
1116
2.10.0.pr2 (31-Aug-2019)
1217

1318
#139: (properties) Support for Map<String, String> in `JavaPropsMapper`

yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@ public JsonToken nextToken() throws IOException
399399
_parsingContext.setCurrentName(name);
400400
return (_currToken = JsonToken.FIELD_NAME);
401401
}
402+
} else if (_parsingContext.inArray()) {
403+
_parsingContext.expectComma();
402404
}
403405

404-
_currentAnchor = null;
405-
406406
// Ugh. Why not expose id, to be able to Switch?
407407
_currentAnchor = null;
408408

yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/deser/StreamingParseTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ public void testAnchorParsing() throws Exception
423423
yp.close();
424424
}
425425

426-
// [Issue#10]
427426
// Scalars should not be parsed when not in the plain flow style.
428427
public void testQuotedStyles() throws Exception
429428
{
@@ -435,8 +434,10 @@ public void testQuotedStyles() throws Exception
435434
assertEquals("strings", p.getCurrentName());
436435
assertToken(JsonToken.START_ARRAY, p.nextToken());
437436
assertToken(JsonToken.VALUE_STRING, p.nextToken());
437+
assertEquals(0, p.getParsingContext().getCurrentIndex());
438438
assertEquals("true", p.getText());
439439
assertToken(JsonToken.VALUE_STRING, p.nextToken());
440+
assertEquals(1, p.getParsingContext().getCurrentIndex());
440441
assertEquals("false", p.getText());
441442
assertToken(JsonToken.END_ARRAY, p.nextToken());
442443
assertToken(JsonToken.END_OBJECT, p.nextToken());
@@ -507,8 +508,10 @@ public void testObjectWithNumbers() throws Exception
507508

508509
assertToken(JsonToken.START_ARRAY, p.nextToken());
509510
assertToken(JsonToken.VALUE_STRING, p.nextToken());
511+
assertEquals(0, p.getParsingContext().getCurrentIndex());
510512
assertEquals("Foo Bar", p.getText());
511513
assertToken(JsonToken.VALUE_STRING, p.nextToken());
514+
assertEquals(1, p.getParsingContext().getCurrentIndex());
512515
assertEquals("Max Power", p.getText());
513516
assertToken(JsonToken.END_ARRAY, p.nextToken());
514517

0 commit comments

Comments
 (0)