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