Skip to content

Commit bb15151

Browse files
committed
Revert #2805, to fix #2878
1 parent 0aa8980 commit bb15151

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

release-notes/VERSION-2.x

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ Project: jackson-databind
44
=== Releases ===
55
------------------------------------------------------------------------
66

7-
2.12.0 (not yet released)
7+
8+
2.12.0-rc2 (not yet released)
9+
10+
#2878: Revert change initially made to fix #2805: change in signature
11+
of `ObjectMapper.treeToValue()` regarding exceptions
12+
13+
2.12.0-rc1 (12-Oct-2020)
814

915
#43: Add option to resolve type from multiple existing properties,
1016
`@JsonTypeInfo(use=DEDUCTION)`
@@ -65,7 +71,6 @@ Project: jackson-databind
6571
(reported by mjustin@github)
6672
#2800: Extract getter/setter/field name mangling from `BeanUtil` into
6773
pluggable `AccessorNamingStrategy`
68-
#2805: Remove `JsonProcessingException` from `ObjectMapper.treeToValue()`
6974
#2873: `MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS` should work for enum as keys
7075
(fix contributed by Ilya G)
7176
- Add `BeanDeserializerBase.isCaseInsensitive()`

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -3206,11 +3206,17 @@ public JsonParser treeAsTokens(TreeNode n) {
32063206
*<pre>
32073207
* objectMapper.convertValue(n, valueClass);
32083208
*</pre>
3209+
*<p>
3210+
* Note: erroneously includes {@code throws JsonProcessingException} even
3211+
* though this exception is never thrown, only {@link IllegalArgumentException}
3212+
* is thrown. But since changing exception part of method signature is
3213+
* source-incompatible change, needs to be retained until 3.0.
32093214
*/
32103215
@SuppressWarnings("unchecked")
32113216
@Override
32123217
public <T> T treeToValue(TreeNode n, Class<T> valueType)
3213-
throws IllegalArgumentException
3218+
throws IllegalArgumentException,
3219+
JsonProcessingException // is NOT actually thrown but retained as per #2878
32143220
{
32153221
if (n == null) {
32163222
return null;

src/test/java/com/fasterxml/jackson/databind/node/TestConversions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public void testBufferedLongViaCoercion() throws Exception {
316316
assertEquals(Long.valueOf(EXP), obj.longObj);
317317
}
318318

319-
public void testConversionsOfNull()
319+
public void testConversionsOfNull() throws Exception
320320
{
321321
// First: `null` value should become `NullNode`
322322
JsonNode n = MAPPER.valueToTree(null);

0 commit comments

Comments
 (0)