File tree 3 files changed +13
-1
lines changed
cbor/src/test/java/com/fasterxml/jackson/dataformat/cbor
smile/src/test/java/com/fasterxml/jackson/dataformat/smile
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 6
6
import java .io .SequenceInputStream ;
7
7
8
8
import com .fasterxml .jackson .core .JsonFactory ;
9
+ import com .fasterxml .jackson .core .JsonLocation ;
9
10
import com .fasterxml .jackson .core .JsonParser ;
10
11
11
12
import com .fasterxml .jackson .databind .JsonNode ;
@@ -48,9 +49,13 @@ public void testInputStreamWithHugeValueThatOverlaps() throws Exception {
48
49
parser .nextToken ();
49
50
parser .finishToken ();
50
51
51
- final long start = parser .getCurrentLocation ().getByteOffset ();
52
+ JsonLocation loc = parser .getCurrentLocation ();
53
+ final long start = loc .getByteOffset ();
52
54
assertEquals (7999 , start );
53
55
56
+ assertEquals ("byte offset: #7999" , loc .offsetDescription ());
57
+ assertEquals ("(ByteArrayInputStream)" , loc .sourceDescription ());
58
+
54
59
parser .nextToken ();
55
60
parser .finishToken ();
56
61
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ public void testInvalidShortUnicode() throws Exception
39
39
verifyException (e , "Truncated UTF-8 character in Short Unicode String" );
40
40
verifyException (e , "(12 bytes)" );
41
41
verifyException (e , "byte 0xE5 at offset #10 indicated 2 more bytes needed" );
42
+ verifyException (e , "(byte[])" ); // source description for raw source
43
+ verifyException (e , "[29 bytes]" ); // - "" -
44
+ verifyException (e , "byte offset: #29" ); // with 2.13 we get this too
42
45
}
43
46
}
44
47
}
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ public void testSimpleOffsets() throws IOException
26
26
// but first 4 bytes are for header
27
27
assertEquals (4 , loc .getByteOffset ());
28
28
29
+ // Let's verify Location info (quite minimal for Binary content)
30
+ assertEquals ("byte offset: #4" , loc .offsetDescription ());
31
+ assertEquals ("(byte[])[12 bytes]" , loc .sourceDescription ());
32
+
29
33
// array marker is a single byte, so:
30
34
assertToken (JsonToken .START_ARRAY , p .nextToken ());
31
35
assertEquals (5 , p .getCurrentLocation ().getByteOffset ());
You can’t perform that action at this time.
0 commit comments