Why is a ConcurrentModificationException thrown and how to debug it

This is not a synchronization problem. This will occur if the underlying collection that is being iterated over is modified by anything other than the Iterator itself. This will throw a ConcurrentModificationException when the it.hasNext() is called the second time. The correct approach would be Assuming this iterator supports the remove() operation.

Connection Java – MySQL : Public Key Retrieval is not allowed

You should add client option to your mysql-connector allowPublicKeyRetrieval=true to allow the client to automatically request the public key from the server. Note that allowPublicKeyRetrieval=True could allow a malicious proxy to perform a MITM attack to get the plaintext password, so it is False by default and must be explicitly enabled. you could also try … Read more

java.net.SocketException: Network is unreachable: connect

You are facing a connection breakdown. Does this happen in 3G, WiFi or “plain” connection on a computer? Anyway, you must assume that the connection may be lost from time to time, when writing your app. For example, with mobiles, this happens frequently in the tube, in basements, etc. With PC apps, this is less … Read more