@@ -187,14 +187,65 @@ protected JacksonException(Throwable rootCause) {
187
187
}
188
188
189
189
protected JacksonException (String msg , Throwable rootCause ) {
190
- this (msg , null , rootCause );
190
+ this (null , msg , null , rootCause );
191
191
}
192
192
193
193
protected JacksonException (String msg , JsonLocation loc , Throwable rootCause ) {
194
+ this (null , msg , loc , rootCause );
195
+ }
196
+
197
+ protected JacksonException (Closeable processor , Throwable rootCause ) {
198
+ super (rootCause );
199
+ _processor = processor ;
200
+ _location = _nonNullLocation (null );
201
+ }
202
+
203
+ protected JacksonException (Closeable processor , String msg , JsonLocation loc ,
204
+ Throwable rootCause ) {
194
205
super (msg , rootCause );
195
- _location = (loc == null ) ? JsonLocation .NA : loc ;
206
+ _processor = processor ;
207
+ _location = _nonNullLocation (loc );
208
+ }
209
+
210
+ protected JacksonException (Closeable processor , String msg )
211
+ {
212
+ super (msg );
213
+ _processor = processor ;
214
+ JsonLocation loc = null ;
215
+ if (processor instanceof JsonParser ) {
216
+ // 17-Aug-2015, tatu: Use of token location makes some sense from databinding,
217
+ // since actual parsing (current) location is typically only needed for low-level
218
+ // parsing exceptions.
219
+ // 10-Jun-2024, tatu: Used from streaming too, current location possibly better
220
+ loc = ((JsonParser ) processor ).currentLocation ();
221
+ }
222
+ _location = _nonNullLocation (loc );
196
223
}
197
224
225
+ protected JacksonException (Closeable processor , String msg , Throwable problem )
226
+ {
227
+ super (msg , problem );
228
+ _processor = processor ;
229
+ JsonLocation loc = null ;
230
+ if (problem instanceof JacksonException ) {
231
+ loc = ((JacksonException ) problem ).getLocation ();
232
+ } else if (processor instanceof JsonParser ) {
233
+ loc = ((JsonParser ) processor ).currentLocation ();
234
+ }
235
+ _location = _nonNullLocation (loc );
236
+ }
237
+
238
+ protected JacksonException (Closeable processor , String msg , JsonLocation loc )
239
+ {
240
+ super (msg );
241
+ _processor = processor ;
242
+ _location = _nonNullLocation (loc );
243
+ }
244
+
245
+ private static JsonLocation _nonNullLocation (JsonLocation loc ) {
246
+ return (loc == null ) ? JsonLocation .NA : loc ;
247
+ }
248
+
198
249
// @since 3.0
199
250
public JacksonException withCause (Throwable cause ) {
200
251
initCause (cause );
0 commit comments