@@ -319,9 +319,8 @@ public static JsonMappingException from(SerializerProvider ctxt, String msg) {
319319 * @since 2.7
320320 */
321321 public static JsonMappingException from (SerializerProvider ctxt , String msg , Throwable problem ) {
322- /* 17-Aug-2015, tatu: As per [databind#903] this is bit problematic as
323- * SerializerProvider instance does not currently hold on to generator...
324- */
322+ // 17-Aug-2015, tatu: As per [databind#903] this is bit problematic as
323+ // SerializerProvider instance does not currently hold on to generator...
325324 return new JsonMappingException (_generator (ctxt ), msg , problem );
326325 }
327326
@@ -509,15 +508,7 @@ protected String _buildMessage()
509508 return msg ;
510509 }
511510 StringBuilder sb = (msg == null ) ? new StringBuilder () : new StringBuilder (msg );
512- /* 18-Feb-2009, tatu: initially there was a linefeed between
513- * message and path reference; but unfortunately many systems
514- * (loggers, junit) seem to assume linefeeds are only added to
515- * separate stack trace.
516- */
517- sb .append (" (through reference chain: " );
518- sb = getPathReference (sb );
519- sb .append (')' );
520- return sb .toString ();
511+ return _appendReferenceChain (sb ).toString ();
521512 }
522513
523514 @ Override
@@ -532,6 +523,26 @@ public String toString()
532523 /**********************************************************************
533524 */
534525
526+ /**
527+ * Method that is called to add reference chain
528+ * information to message, but may be overridden to customize
529+ * handling, including appending other information or removing
530+ * the reference chain altogether.
531+ *
532+ * @since 2.18.2
533+ */
534+ protected StringBuilder _appendReferenceChain (StringBuilder sb )
535+ {
536+ // 18-Feb-2009, tatu: initially there was a linefeed between
537+ // message and path reference; but unfortunately many systems
538+ // (loggers, junit) seem to assume linefeeds are only added to
539+ // separate stack trace.
540+ sb .append (" (through reference chain: " );
541+ sb = getPathReference (sb );
542+ sb .append (')' );
543+ return sb ;
544+ }
545+
535546 protected void _appendPathDesc (StringBuilder sb )
536547 {
537548 if (_path == null ) {
0 commit comments