@@ -689,8 +689,11 @@ protected void serializeFields(Object bean, JsonGenerator gen, SerializerProvide
689
689
* have many stack frames to spare... just one or two; can't
690
690
* make many calls.
691
691
*/
692
- JsonMappingException mapE = JsonMappingException .from (gen , "Infinite recursion (StackOverflowError)" , e );
693
- String name = (i == props .length ) ? "[anySetter]" : props [i ].getName ();
692
+ // 10-Dec-2015, tatu: and due to above, avoid "from" method, call ctor directly:
693
+ //JsonMappingException mapE = JsonMappingException.from(gen, "Infinite recursion (StackOverflowError)", e);
694
+ JsonMappingException mapE = new JsonMappingException (gen , "Infinite recursion (StackOverflowError)" , e );
695
+
696
+ String name = (i == props .length ) ? "[anySetter]" : props [i ].getName ();
694
697
mapE .prependPath (new JsonMappingException .Reference (bean , name ));
695
698
throw mapE ;
696
699
}
@@ -735,7 +738,9 @@ protected void serializeFieldsFiltered(Object bean, JsonGenerator gen,
735
738
String name = (i == props .length ) ? "[anySetter]" : props [i ].getName ();
736
739
wrapAndThrow (provider , e , bean , name );
737
740
} catch (StackOverflowError e ) {
738
- JsonMappingException mapE = JsonMappingException .from (gen , "Infinite recursion (StackOverflowError)" , e );
741
+ // Minimize call depth since we are close to fail:
742
+ //JsonMappingException mapE = JsonMappingException.from(gen, "Infinite recursion (StackOverflowError)", e);
743
+ JsonMappingException mapE = new JsonMappingException (gen , "Infinite recursion (StackOverflowError)" , e );
739
744
String name = (i == props .length ) ? "[anySetter]" : props [i ].getName ();
740
745
mapE .prependPath (new JsonMappingException .Reference (bean , name ));
741
746
throw mapE ;
0 commit comments