@@ -1780,30 +1780,32 @@ private void populateMap(Object bean, Set<Object> objectsRecord, JSONParserConfi
17801780
17811781 Method [] methods = includeSuperClass ? klass .getMethods () : klass .getDeclaredMethods ();
17821782 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+ }
17941795
1795- objectsRecord .add (result );
1796+ objectsRecord .add (result );
17961797
1797- testValidity (result );
1798- this .map .put (key , wrap (result , objectsRecord ));
1798+ testValidity (result );
1799+ this .map .put (key , wrap (result , objectsRecord ));
17991800
1800- objectsRecord .remove (result );
1801+ objectsRecord .remove (result );
18011802
1802- closeClosable (result );
1803+ closeClosable (result );
1804+ }
1805+ } catch (IllegalAccessException ignore ) {
1806+ } catch (IllegalArgumentException ignore ) {
1807+ } catch (InvocationTargetException ignore ) {
18031808 }
1804- } catch (IllegalAccessException ignore ) {
1805- } catch (IllegalArgumentException ignore ) {
1806- } catch (InvocationTargetException ignore ) {
18071809 }
18081810 }
18091811 }
@@ -1814,10 +1816,6 @@ private static boolean isValidMethodName(String name) {
18141816 }
18151817
18161818 private static String getKeyNameFromMethod (Method method ) {
1817- if (!isValidMethod (method )) {
1818- return null ;
1819- }
1820-
18211819 final int ignoreDepth = getAnnotationDepth (method , JSONPropertyIgnore .class );
18221820 if (ignoreDepth > 0 ) {
18231821 final int forcedNameDepth = getAnnotationDepth (method , JSONPropertyName .class );
0 commit comments