77
88public class TestExceptions extends BaseTest
99{
10- private final JsonFactory JSON_F = new JsonFactory ();
10+ private final JsonFactory JSON_F = newStreamFactory ();
1111
1212 // For [core#10]
1313 public void testOriginalMesssage ()
@@ -123,26 +123,30 @@ private void _testEofExceptions(int mode) throws Exception
123123
124124 public void testContentSnippetWithOffset () throws Exception
125125 {
126+ final JsonFactory jsonF = this .streamFactoryBuilder ()
127+ .enable (StreamReadFeature .INCLUDE_SOURCE_IN_LOCATION )
128+ .build ();
129+
126130 JsonParser p ;
127131 final String json = a2q ("{'k1':'v1'}\n [broken]\n " );
128132 final byte [] jsonB = utf8Bytes (json );
129133 final int lfIndex = json .indexOf ("\n " );
130134 final int start = lfIndex +1 ;
131135 final int len = json .length () - start ;
132136
133- p = JSON_F .createParser (jsonB , start , len );
137+ p = jsonF .createParser (jsonB , start , len );
134138 // for byte-based, will be after character that follows token:
135139 // (and alas cannot be easily fixed)
136140 _testContentSnippetWithOffset (p , 9 , "(byte[])\" [broken]\n \" " );
137141 p .close ();
138142
139143 final char [] jsonC = json .toCharArray ();
140- p = JSON_F .createParser (jsonC , start , len );
144+ p = jsonF .createParser (jsonC , start , len );
141145 // for char-based we get true offset at end of token
142146 _testContentSnippetWithOffset (p , 8 , "(char[])\" [broken]\n \" " );
143147 p .close ();
144148
145- p = JSON_F .createParser (json .substring (start ));
149+ p = jsonF .createParser (json .substring (start ));
146150 // for char-based we get true offset at end of token
147151 _testContentSnippetWithOffset (p , 8 , "(String)\" [broken]\n \" " );
148152 p .close ();
@@ -161,7 +165,6 @@ private void _testContentSnippetWithOffset(final JsonParser p,
161165 assertEquals (1 , loc .getLineNr ());
162166 assertEquals (expColumn , loc .getColumnNr ());
163167 final String srcDesc = loc .sourceDescription ();
164-
165168 assertEquals (expContent , srcDesc );
166169 }
167170 }
0 commit comments