mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-06 10:45:23 +08:00
locate the pace for cyclic check
This commit is contained in:
@@ -1540,10 +1540,12 @@ public class JSONObject {
|
||||
try {
|
||||
final Object result = method.invoke(bean);
|
||||
if (result != null) {
|
||||
// check cyclic dependency and throw error if needed
|
||||
|
||||
this.map.put(key, wrap(result));
|
||||
// we don't use the result anywhere outside of wrap
|
||||
// if it's a resource we should be sure to close it
|
||||
// after calling toString
|
||||
// after calling toString
|
||||
if (result instanceof Closeable) {
|
||||
try {
|
||||
((Closeable) result).close();
|
||||
|
Reference in New Issue
Block a user