Properly check FTP server connection
问题 I open a connection to an FTP server at the start of my program. Before I perform operations on the server I want to check if the connection was successfully established. The easiest fast manner so if the connection is gone, I will try to connect again. I used this code to do this: private boolean checkConnection() { try { boolean success = ftpClient.login(user_name, password); if(success) return true; else return false; } } But this method throws a NullPointer exception when the connection