Skip to content

Commit 03500a6

Browse files
committed
Merge branch '2.18' into 2.19
2 parents b2be291 + 7499852 commit 03500a6

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {

src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,22 @@ public abstract class PropertyBindingException
1919
extends MismatchedInputException // since 2.9
2020
{
2121
/**
22-
* Class that does not contain mapping for the unrecognized property.
22+
* Class that has the problem with mapping of a property (unrecognized,
23+
* missing, etc).
2324
*/
2425
protected final Class<?> _referringClass;
2526

2627
/**
28+
* Name of property that has the problem being reported.
2729
*<p>
28-
* Note: redundant information since it is also included in the
29-
* reference path.
30+
* Note: possibly redundant information since it may also included
31+
* in the reference path.
3032
*/
3133
protected final String _propertyName;
3234

3335
/**
34-
* Set of ids of properties that are known for the type, if this
35-
* can be statically determined.
36+
* Set of ids of properties that are known for the type (see
37+
* {@code _referringClass}, if ids can be statically determined.
3638
*/
3739
protected final Collection<Object> _propertyIds;
3840

@@ -119,17 +121,17 @@ public String getMessageSuffix()
119121
*/
120122

121123
/**
122-
* Method for accessing type (class) that is missing definition to allow
123-
* binding of the unrecognized property.
124+
* Method for accessing type (class) that has the problematic property.
124125
*/
125126
public Class<?> getReferringClass() {
126127
return _referringClass;
127128
}
128129

129130
/**
130131
* Convenience method for accessing logical property name that could
131-
* not be mapped. Note that it is the last path reference in the
132-
* underlying path.
132+
* not be mapped (see {@link #_propertyName}).
133+
* Note that it is likely the last path reference in the underlying path
134+
* (but not necessarily, depending on the type of problem).
133135
*/
134136
public String getPropertyName() {
135137
return _propertyName;

0 commit comments

Comments
 (0)