fix indentation
use InetAddressUtils, also handle exceptions more anally