I'm developing a Swing application that also does use a REST-API. I'm using Jersey to accomplish this.
I want the user to input a URL into a TextField and would like to give him some feedback if the URL is malformed or anything. I'm using URI as a basis to store the URL and am able to catch any problems that arise with that and give the user some informations.
} catch (URISyntaxException ex) {
MainClass.write2Log("URL wrong : '" + baseURL + "'");
}
Now, when the URL has the right format, but simply doesn't resolve, I get this exception :
Exception in thread "AWT-EventQueue-0" javax.ws.rs.ProcessingException:
java.net.UnknownHostException: sx.dddsds.ded
at org.glassfish.jersey.client.HttpUrlConnector.
apply(HttpUrlConnector.java:205)
So my questions is this : How can I 'catch' this exception when I don't have the Object that throws this exception?
Thanks in advance !