Skip to content

Commit

Permalink
Fix #51
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 4, 2020
1 parent f52abd9 commit a2b3d2e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ Damian Servin (Qnzvna@github)
* Contributed #195 (csv) Adds schema creating csv schema with View
(2.11.0)

Rob Spoor (robtimus@github)
* Reported #51: (yaml) `YAMLParser._locationFor()` does not use index available from
`Mark`object of Event
(2.11.1)
4 changes: 3 additions & 1 deletion release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Project: jackson-datatypes-text

2.11.1 (not yet released)

-
#51: (yaml) `YAMLParser._locationFor()` does not use index available from `Mark`
object of Event
(reported by Rob S)

2.11.0 (26-Apr-2020)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ protected JsonLocation _locationFor(Mark m)
-1, -1, -1);
}
return new JsonLocation(_ioContext.getSourceReference(),
-1,
m.getIndex(),
m.getLine() + 1, // from 0- to 1-based
m.getColumn() + 1); // ditto
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fasterxml.jackson.dataformat.yaml.deser;

import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.dataformat.yaml.ModuleTestBase;
Expand Down Expand Up @@ -33,9 +34,21 @@ public void testBasic() throws Exception
assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertToken(JsonToken.VALUE_STRING, p.nextToken());
assertEquals("text", p.getText());
JsonLocation loc = p.getTokenLocation();
assertEquals(1, loc.getLineNr());
assertEquals(9, loc.getColumnNr());
assertEquals(8, loc.getCharOffset());
assertEquals(-1, loc.getByteOffset());

assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertToken(JsonToken.VALUE_TRUE, p.nextToken());
assertEquals("true", p.getText());
loc = p.getTokenLocation();
assertEquals(2, loc.getLineNr());
assertEquals(7, loc.getColumnNr());
assertEquals(21, loc.getCharOffset());
assertEquals(-1, loc.getByteOffset());

assertToken(JsonToken.FIELD_NAME, p.nextToken());
assertToken(JsonToken.VALUE_FALSE, p.nextToken());
assertEquals("false", p.getText());
Expand Down

0 comments on commit a2b3d2e

Please sign in to comment.