Why is UnknownHostException not caught in Exception (java)? -


my code looks :

try {    string htmlpagetext=readfromhtml("http://www.yahoo.com"); } catch (exception e) {   system.out.println("===here==="); } 

method readfromhtml() take url , return html page. works fine. i'm trying simulate "site down" situation, unplugged internet connection. thought, error should caught , result "===here===", instead, returned:

java.net.unknownhostexception: http://www.yahoo.com" 

and never printed out "===here===". unknownhostexception extension of java.lang.exception, why not caught in catch clause? need catch (unknownhostexception ex) it?

what readfromhtml method source code ? guess method throws kind of exception not unknownhostexception... somewhere else in code exception left unhandled.


Comments

Popular posts from this blog

Delphi Wmi Query on a Remote Machine -