Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当有循环引用时, 调用JSONArray.hashCode()堆栈溢出 #76

Closed
juqkai opened this issue Sep 6, 2013 · 2 comments
Closed

当有循环引用时, 调用JSONArray.hashCode()堆栈溢出 #76

juqkai opened this issue Sep 6, 2013 · 2 comments

Comments

@juqkai
Copy link

juqkai commented Sep 6, 2013

#74 的JSON应该就会导致这个问题, 使用JSON.parse(json) 生成对象, 然后遍历里面的对象, 放进MAP中做为KEY, 然后使用map.containsKey()就可以触发

Caused by: java.lang.StackOverflowError
at java.util.HashMap$EntryIterator.<init>(HashMap.java:932)
at java.util.HashMap.newEntryIterator(HashMap.java:946)
at java.util.HashMap$EntrySet.iterator(HashMap.java:1050)
at java.util.AbstractMap.hashCode(AbstractMap.java:492)
at com.alibaba.fastjson.JSONObject.hashCode(JSONObject.java:331)
at java.util.HashMap$Entry.hashCode(HashMap.java:818)
at java.util.AbstractMap.hashCode(AbstractMap.java:494)
at com.alibaba.fastjson.JSONObject.hashCode(JSONObject.java:331)
at java.util.HashMap$Entry.hashCode(HashMap.java:818)
at java.util.AbstractMap.hashCode(AbstractMap.java:494)
at com.alibaba.fastjson.JSONObject.hashCode(JSONObject.java:331)
at java.util.AbstractList.hashCode(AbstractList.java:541)
at com.alibaba.fastjson.JSONArray.hashCode(JSONArray.java:366)
at java.util.HashMap$Entry.hashCode(HashMap.java:818)
at java.util.AbstractMap.hashCode(AbstractMap.java:494)
at com.alibaba.fastjson.JSONObject.hashCode(JSONObject.java:331)
at java.util.HashMap$Entry.hashCode(HashMap.java:818)
at java.util.AbstractMap.hashCode(AbstractMap.java:494)
at com.alibaba.fastjson.JSONObject.hashCode(JSONObject.java:331)
at java.util.AbstractList.hashCode(AbstractList.java:541)
at com.alibaba.fastjson.JSONArray.hashCode(JSONArray.java:366)
at java.util.HashMap$Entry.hashCode(HashMap.java:818)
at java.util.AbstractMap.hashCode(AbstractMap.java:494)
at com.alibaba.fastjson.JSONObject.hashCode(JSONObject.java:331)
at java.util.HashMap$Entry.hashCode(HashMap.java:818)
at java.util.AbstractMap.hashCode(AbstractMap.java:494)
at com.alibaba.fastjson.JSONObject.hashCode(JSONObject.java:331)
at java.util.AbstractList.hashCode(AbstractList.java:541)
at com.alibaba.fastjson.JSONArray.hashCode(JSONArray.java:366)
at java.util.HashMap$Entry.hashCode(HashMap.java:818)
at java.util.AbstractMap.hashCode(AbstractMap.java:494)
at com.alibaba.fastjson.JSONObject.hashCode(JSONObject.java:331)
juqkai added a commit to juqkai/fastjson that referenced this issue Sep 7, 2013
但是感觉不够完整, 需要再做修正
@wenshao
Copy link
Member

wenshao commented Sep 8, 2013

这确实是一个bug!

@wenshao
Copy link
Member

wenshao commented Oct 3, 2014

java.util.ArrayList也有同样的问题,这个不算是bug

@wenshao wenshao closed this as completed Oct 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants