@@ -19,8 +19,9 @@ public class JacksonException
19
19
/**
20
20
* Let's limit length of reference chain, to limit damage in cases
21
21
* of infinite recursion.
22
+ * Use maximum nesting limit allowed for reads.
22
23
*/
23
- private final static int MAX_REFS_TO_LIST = 1000 ;
24
+ private final static int MAX_REFS_TO_LIST = StreamReadConstraints . DEFAULT_MAX_DEPTH ;
24
25
25
26
/**
26
27
* Simple bean class used to contain references. References
@@ -483,24 +484,39 @@ public Object processor() {
483
484
/**********************************************************************
484
485
*/
485
486
487
+ @ Override
488
+ public String getLocalizedMessage () {
489
+ return _buildMessage ();
490
+ }
491
+
492
+ /**
493
+ * Method is overridden so that we can properly inject description
494
+ * of problem path, if such is defined.
495
+ */
496
+ @ Override
497
+ public String getMessage () {
498
+ return _buildMessage ();
499
+ }
500
+
486
501
/**
487
502
* Default method overridden so that we can add location information
488
503
*
489
504
* @return Message constructed based on possible optional prefix; explicit
490
505
* {@code message} passed to constructor as well trailing location description
491
506
* (separate from message by linefeed)
492
507
*/
493
- @ Override public String getMessage () {
494
- String msg = super .getMessage ();
495
- if (msg == null ) {
496
- msg = "N/A" ;
508
+ protected String _buildMessage ()
509
+ {
510
+ String baseMessage = super .getMessage ();
511
+ if (baseMessage == null ) {
512
+ baseMessage = "N/A" ;
497
513
}
498
514
JsonLocation loc = getLocation ();
499
515
String suffix = messageSuffix ();
500
516
// mild optimization, if nothing extra is needed:
517
+ StringBuilder sb = new StringBuilder (200 );
518
+ sb .append (baseMessage );
501
519
if ((loc != null ) || suffix != null ) {
502
- StringBuilder sb = new StringBuilder (100 );
503
- sb .append (msg );
504
520
if (suffix != null ) {
505
521
sb .append (suffix );
506
522
}
@@ -509,12 +525,21 @@ public Object processor() {
509
525
sb .append (" at " );
510
526
sb = loc .toString (sb );
511
527
}
512
- msg = sb .toString ();
513
528
}
514
- return msg ;
529
+ if (_path != null ) {
530
+ // 18-Feb-2009, tatu: originally there was a linefeed between
531
+ // message and path reference; but unfortunately many systems
532
+ // (loggers, junit) seem to assume linefeeds are only added to
533
+ // separate stack trace.
534
+ sb .append (" (through reference chain: " );
535
+ sb = getPathReference (sb );
536
+ sb .append (')' );
537
+ }
538
+ return sb .toString ();
515
539
}
516
540
517
- @ Override public String toString () { return getClass ().getName ()+": " +getMessage (); }
541
+ @ Override
542
+ public String toString () { return getClass ().getName ()+": " +getMessage (); }
518
543
519
544
/*
520
545
/**********************************************************************
0 commit comments