-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
java.util.ConcurrentModificationException #2714
Comments
Can you please provide a minimal, reproducible example so that we can reproduce this issue? |
I'm having exactly the same problem in the piece of code below:
Notes:
The only case that its happening this crash is within Gson().toJson(). It's difficult to reproduce this error but at my company we have millions of active users and a low percentage of them are getting this exception. |
But only within this function the type is I assume whether you use Does your code snippet really match your production code? The |
Gson version
2.11.0
Java / Android version
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1574)
at java.util.HashMap$EntryIterator.next(HashMap.java:1607)
at java.util.HashMap$EntryIterator.next(HashMap.java:1605)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:220)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:154)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:73)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$2.write(ReflectiveTypeAdapterFactory.java:247)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:490)
at com.google.gson.Gson.toJson(Gson.java:944)
at com.google.gson.Gson.toJson(Gson.java:899)
at com.google.gson.Gson.toJson(Gson.java:848)
at com.google.gson.Gson.toJson(Gson.java:825)
Used tools
Description
Expected behavior
Actual behavior
Reproduction steps
Exception stack trace
The text was updated successfully, but these errors were encountered: