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