I am using a library that sometimes (about 1 of 100 times) throws a ConcurrentModificationException
leading to an app crash.
The stacktrace does not mention any code of mine but instead the code of the library. I tried to catch the exception where I call the library however it does not work.
I guess the exception is thrown in a new thread within the library.
How could I catch such an exception?
Libary: Old Philips Hue Java library. (I am going to switch to the new one, soon.)
Exception:
E/AndroidRuntime: FATAL EXCEPTION: Thread-21319
Process: my.package, PID: 21561
Theme: themes:{...}
java.util.ConcurrentModificationException
at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
at com.philips.lighting.hue.sdk.notification.impl.PHNotificationManagerImpl$3.onReceived(PHNotificationManagerImpl.java:180)
at com.philips.lighting.hue.sdk.notification.impl.PHHueResultReceiver.execute(PHHueResultReceiver.java:24)
at com.philips.lighting.hue.sdk.notification.impl.PHNotificationManagerImpl.notifyBridgeSearchResult(PHNotificationManagerImpl.java:188)
at com.philips.lighting.hue.sdk.upnp.PHBridgeSearchManagerImpl$1.run(PHBridgeSearchManagerImpl.java:198)