wangyao5 / json-smart

Automatically exported from code.google.com/p/json-smart
0 stars 0 forks source link

ConcurrentModificationException when writing object to storage #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When executing the following code 

out = new FileWriter(new File("/sdcard/foo"));
((JSONObject) value).writeJSONString(out, JSONStyle.MAX_COMPRESS);

I get this stacktrace:

Failed to write object to SD: Member
java.util.ConcurrentModificationException
java.util.HashMap$HashIterator.nextEntry(HashMap.java:792)
java.util.HashMap$EntryIterator.next(HashMap.java:829)
java.util.HashMap$EntryIterator.next(HashMap.java:827)
04-09 17:20:04.786: E/com.flud.util.JsonUtils(537):     at 
net.minidev.json.JSONObject.writeJSONString(JSONObject.java:191)

This seems to only happen for JSONObject but not for JSONArray. I'm using v. 
1.1.1 on Android

Original issue reported on code.google.com by bost...@gmail.com on 9 Apr 2012 at 5:28

GoogleCodeExporter commented 9 years ago
the bug probably comming from com.flud.util.JsonUtils

for your information a JsonParser object is not thread safe.

Original comment by uriel.chemouni on 1 Sep 2013 at 7:11