@@ -1780,30 +1780,32 @@ private void populateMap(Object bean, Set<Object> objectsRecord, JSONParserConfi
1780
1780
1781
1781
Method [] methods = includeSuperClass ? klass .getMethods () : klass .getDeclaredMethods ();
1782
1782
for (final Method method : methods ) {
1783
- final String key = getKeyNameFromMethod (method );
1784
- if (key != null && !key .isEmpty ()) {
1785
- try {
1786
- final Object result = method .invoke (bean );
1787
- if (result != null || jsonParserConfiguration .isUseNativeNulls ()) {
1788
- // check cyclic dependency and throw error if needed
1789
- // the wrap and populateMap combination method is
1790
- // itself DFS recursive
1791
- if (objectsRecord .contains (result )) {
1792
- throw recursivelyDefinedObjectException (key );
1793
- }
1783
+ if (isValidMethod (method )) {
1784
+ final String key = getKeyNameFromMethod (method );
1785
+ if (key != null && !key .isEmpty ()) {
1786
+ try {
1787
+ final Object result = method .invoke (bean );
1788
+ if (result != null || jsonParserConfiguration .isUseNativeNulls ()) {
1789
+ // check cyclic dependency and throw error if needed
1790
+ // the wrap and populateMap combination method is
1791
+ // itself DFS recursive
1792
+ if (objectsRecord .contains (result )) {
1793
+ throw recursivelyDefinedObjectException (key );
1794
+ }
1794
1795
1795
- objectsRecord .add (result );
1796
+ objectsRecord .add (result );
1796
1797
1797
- testValidity (result );
1798
- this .map .put (key , wrap (result , objectsRecord ));
1798
+ testValidity (result );
1799
+ this .map .put (key , wrap (result , objectsRecord ));
1799
1800
1800
- objectsRecord .remove (result );
1801
+ objectsRecord .remove (result );
1801
1802
1802
- closeClosable (result );
1803
+ closeClosable (result );
1804
+ }
1805
+ } catch (IllegalAccessException ignore ) {
1806
+ } catch (IllegalArgumentException ignore ) {
1807
+ } catch (InvocationTargetException ignore ) {
1803
1808
}
1804
- } catch (IllegalAccessException ignore ) {
1805
- } catch (IllegalArgumentException ignore ) {
1806
- } catch (InvocationTargetException ignore ) {
1807
1809
}
1808
1810
}
1809
1811
}
@@ -1814,10 +1816,6 @@ private static boolean isValidMethodName(String name) {
1814
1816
}
1815
1817
1816
1818
private static String getKeyNameFromMethod (Method method ) {
1817
- if (!isValidMethod (method )) {
1818
- return null ;
1819
- }
1820
-
1821
1819
final int ignoreDepth = getAnnotationDepth (method , JSONPropertyIgnore .class );
1822
1820
if (ignoreDepth > 0 ) {
1823
1821
final int forcedNameDepth = getAnnotationDepth (method , JSONPropertyName .class );
0 commit comments