The java.nio.channels.DatagramChannel.send() method throws AlreadyConnectedException instead of IllegalArgumentException

Prior to Java 11, the java.nio.channels.DatagramChannel.send(ByteBuffer,SocketAddress) method would throw an java.lang.IllegalArgumentException when the DatagramChannel object was connected to a different address than the argument passed to the send method.

This rule has an automated fix to replace IllegalArgumentException with AlreadyConnectedException in try/catch using DatagramChannel.send(). Copy the custom configuration to your application build file to enable the fix automation.

For more information on the java.nio.channels.DatagramChannel class, see java.nio.channels.DatagramChannel.

For more information on Java SE 11 changes, see Removed APIs in JDK 11.