File tree Expand file tree Collapse file tree 5 files changed +41
-2
lines changed
main/java/com/fasterxml/jackson/databind
test/java/com/fasterxml/jackson/databind Expand file tree Collapse file tree 5 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -476,6 +476,11 @@ Max Drobotov (fizmax@github)
476
476
* Reported, contributed fix for #1332: `ArrayIndexOutOfBoundException` for enum by index deser
477
477
(2.7.7)
478
478
479
+ Josh Caplan (jecaplan@github)
480
+ * Reported, suggested fix for #1368: Problem serializing `JsonMappingException` due to addition
481
+ of non-ignored `processor` property (added in 2.7)
482
+ (2.7.8)
483
+
479
484
Artur Jonkisz (ajonkisz@github)
480
485
* Reported #960: `@JsonCreator` not working on a factory with no arguments for ae enum type
481
486
(2.8.0)
Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ Project: jackson-databind
93
93
#1359: Improve `JsonNode` deserializer to create `FloatNode` if parser supports
94
94
#1362: ObjectReader.readValues()` ignores offset and length when reading an array
95
95
(reported by wastevenson@github)
96
+ #1368: Problem serializing `JsonMappingException` due to addition of non-ignored
97
+ `processor` property (added in 2.7)
98
+ (reported, suggesed fix by Josh C)
96
99
97
100
2.7.7 (27-Aug-2016)
98
101
Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ public List<Reference> getPath()
401
401
}
402
402
403
403
/**
404
- * Method for accesing description of path that lead to the
404
+ * Method for accessing description of path that lead to the
405
405
* problem that triggered this exception
406
406
*/
407
407
public String getPathReference ()
@@ -455,6 +455,7 @@ public void prependPath(Reference r)
455
455
*/
456
456
457
457
@ Override // since 2.7.5
458
+ @ JsonIgnore // as per [databind#1368]
458
459
public Object getProcessor () { return _processor ; }
459
460
460
461
@ Override
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ static class MyNoArgException extends Exception
44
44
{
45
45
@ JsonCreator MyNoArgException () { }
46
46
}
47
-
47
+
48
48
/*
49
49
/**********************************************************
50
50
/* Tests
Original file line number Diff line number Diff line change @@ -26,6 +26,15 @@ public ExceptionWithIgnoral(String msg) {
26
26
}
27
27
}
28
28
29
+ // [databind#1368]
30
+ static class NoSerdeConstructor {
31
+ private String strVal ;
32
+ public String getVal () { return strVal ; }
33
+ public NoSerdeConstructor ( String strVal ) {
34
+ this .strVal = strVal ;
35
+ }
36
+ }
37
+
29
38
/*
30
39
/**********************************************************
31
40
/* Tests
@@ -91,4 +100,25 @@ public void testIgnorals() throws Exception
91
100
assertNotNull (output );
92
101
assertEquals ("foobar" , output .getMessage ());
93
102
}
103
+
104
+ // [databind#1368]
105
+ public void testJsonMappingExceptionSerialization () throws IOException {
106
+ Exception e = null ;
107
+ // cant deserialize due to unexpected constructor
108
+ try {
109
+ MAPPER .readValue ( "{ \" val\" : \" foo\" }" , NoSerdeConstructor .class );
110
+ fail ("Should not pass" );
111
+ } catch (JsonMappingException e0 ) {
112
+ verifyException (e0 , "no suitable constructor" );
113
+ e = e0 ;
114
+ }
115
+ // but should be able to serialize new exception we got
116
+ String json = MAPPER .writeValueAsString (e );
117
+ JsonNode root = MAPPER .readTree (json );
118
+ String msg = root .path ("message" ).asText ();
119
+ String MATCH = "no suitable constructor" ;
120
+ if (!msg .contains (MATCH )) {
121
+ fail ("Exception should contain '" +MATCH +"', does not: '" +msg +"'" );
122
+ }
123
+ }
94
124
}
You can’t perform that action at this time.
0 commit comments