Java, JXMapKit: How to catch java.net.UnknownHostException

224 views Asked by At

I've implemented JXMapKit in my Java application. How can the java.net.UnknownHostException ("SEVERE: Failed to load a tile at url: ..."), which is raised f.ex. when the internet connection is down, be caught? Do I need to override something from the library?

I have tried to surround all of the lines that have anything to do with the map with try {} catch (Exception e) {} but it seems that the exception cannot be caught that way.

1

There are 1 answers

0
lbalazscs On

I don't know JXMapKit, but if you cannot catch an exception it must be because it it thrown on another thread. In such cases you can use Thread.UncaughtExceptionHandler to get the exceptions.