Skip to content

Commit eb7cf73

Browse files
committed
Fix #1906
1 parent 1ce6a0a commit eb7cf73

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

release-notes/CREDITS-2.x

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,5 +740,7 @@ Alexander Skvortcov (askvortcov@github)
740740
(2.9.4)
741741
742742
Joe Schafer (jschaf@github)
743+
* Reported #1906: Add string format specifier for error message in `PropertyValueBuffer`
744+
(2.9.4)
743745
* Reported #1907: Remove `getClass()` from `_valueType` argument for error reporting
744746
(2.9.4)

release-notes/VERSION-2.x

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
Project: jackson-databin------------------------------------------------------------------------
2-
=== Releases ===
1+
------------------------------------------------------------------------
2+
Project: jackson-databind
33
------------------------------------------------------------------------
44

5+
=== Releases ===
6+
57
2.9.4 (not yet released)
68

79
#1673: Serialising generic value classes via Reference Types (like Optional) fails
@@ -27,6 +29,8 @@ Project: jackson-databin--------------------------------------------------------
2729
(reported by mcortella@github)
2830
#1899: Another two gadgets to exploit default typing issue in jackson-databind
2931
(reported by OneSourceCat@github)
32+
#1906: Add string format specifier for error message in `PropertyValueBuffer`
33+
(reported by Joe S)
3034
#1907: Remove `getClass()` from `_valueType` argument for error reporting
3135
(reported by Joe S)
3236

src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ public Object getParameter(SettableBeanProperty prop)
131131
value = _creatorParameters[prop.getCreatorIndex()] = _findMissing(prop);
132132
}
133133
if (value == null && _context.isEnabled(DeserializationFeature.FAIL_ON_NULL_CREATOR_PROPERTIES)) {
134-
return _context.reportInputMismatch(prop, String.format(
135-
"Null value for creator property '%s'; DeserializationFeature.FAIL_ON_NULL_FOR_CREATOR_PARAMETERS enabled",
136-
prop.getName(), prop.getCreatorIndex()));
134+
return _context.reportInputMismatch(prop,
135+
"Null value for creator property '%s' (index %d); `DeserializationFeature.FAIL_ON_NULL_FOR_CREATOR_PARAMETERS` enabled",
136+
prop.getName(), prop.getCreatorIndex());
137137
}
138138
return value;
139139
}
@@ -172,7 +172,7 @@ public Object[] getParameters(SettableBeanProperty[] props)
172172
if (_creatorParameters[ix] == null) {
173173
SettableBeanProperty prop = props[ix];
174174
_context.reportInputMismatch(prop.getType(),
175-
"Null value for creator property '%s' (index %d); DeserializationFeature.FAIL_ON_NULL_FOR_CREATOR_PARAMETERS enabled",
175+
"Null value for creator property '%s' (index %d); `DeserializationFeature.FAIL_ON_NULL_FOR_CREATOR_PARAMETERS` enabled",
176176
prop.getName(), props[ix].getCreatorIndex());
177177
}
178178
}
@@ -191,14 +191,13 @@ protected Object _findMissing(SettableBeanProperty prop) throws JsonMappingExcep
191191
}
192192
// Second: required?
193193
if (prop.isRequired()) {
194-
_context.reportInputMismatch(prop, String.format(
195-
"Missing required creator property '%s' (index %d)",
196-
prop.getName(), prop.getCreatorIndex()));
194+
_context.reportInputMismatch(prop, "Missing required creator property '%s' (index %d)",
195+
prop.getName(), prop.getCreatorIndex());
197196
}
198197
if (_context.isEnabled(DeserializationFeature.FAIL_ON_MISSING_CREATOR_PROPERTIES)) {
199-
_context.reportInputMismatch(prop, String.format(
200-
"Missing creator property '%s' (index %d); DeserializationFeature.FAIL_ON_MISSING_CREATOR_PROPERTIES enabled",
201-
prop.getName(), prop.getCreatorIndex()));
198+
_context.reportInputMismatch(prop,
199+
"Missing creator property '%s' (index %d); `DeserializationFeature.FAIL_ON_MISSING_CREATOR_PROPERTIES` enabled",
200+
prop.getName(), prop.getCreatorIndex());
202201
}
203202
// Third: default value
204203
JsonDeserializer<Object> deser = prop.getValueDeserializer();

0 commit comments

Comments
 (0)