I have a class that returns a data string from a URL if there is a connection, if not it returns null.
My issue is that I am doing a check:
if (str == null) {
System.out.println("Error: No Connection");
}
However, although this DOES works, this is also printed in the console:
java.net.NoRouteToHostException: No route to host: connect
I’m wondering what this means and if it implies I’ve made an error? Although the program works fine, other this this little exception that keeps popping up. Help?
Complete guess until you post more code… but my guess is you forgot to return after you print your message return str, if not its going to try to execute the rest of your code..