Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > throw the exception but continue the flow?

Reply
Thread Tools

throw the exception but continue the flow?

 
 
Steve
Guest
Posts: n/a
 
      05-01-2008
When it throws the exception, how to not stop the program but keep
continue?

When I get this exception, it stops and cannot continue.

Exception in thread "main" java.io.FileNotFoundException:
at
sun.net.http://www.protocol.http.HttpURLConn...Stream(Unknown So
rce)

please help. thanks
 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      05-01-2008
Steve wrote:
> When it throws the exception, how to not stop the program but keep
> continue?
>
> When I get this exception, it stops and cannot continue.
>
> Exception in thread "main" java.io.FileNotFoundException:
> at
> sun.net.http://www.protocol.http.HttpURLConn...Stream(Unknown So
> rce)
>
> please help. thanks


try {
// put your code here that can throw the exception below in the
// catch part of this structure
} catch (FileNotFoundException e) {
// code here to clean up from your exception
}
// next sequential instruction

--

Knute Johnson
email s/nospam/linux/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 
Reply With Quote
 
 
 
 
Leonard Milcin
Guest
Posts: n/a
 
      05-01-2008
Steve wrote:
> When it throws the exception, how to not stop the program but keep
> continue?
>
> When I get this exception, it stops and cannot continue.
>
> Exception in thread "main" java.io.FileNotFoundException: at
> sun.net.http://www.protocol.http.HttpURLConn...Stream(Unknown So
> rce)
>
> please help. thanks


Reade the manual about try/catch. It's used to detect and handle exception.

Regards,
Leonard

--
Simplicity is the ultimate sophistication.
-- Leonardo da Vinci
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Is there a way to continue after an exception ? Krister Svanlund Python 4 02-21-2010 02:51 AM
To throw or to throw not? Emanuele D'Arrigo Python 6 11-15-2008 04:12 PM
sendmail should throw an exception but does not Clodoaldo Python 4 03-25-2008 03:04 PM
JNI's throw new does not throw an exception yarona@m-sys.com Java 15 09-08-2005 08:36 AM
Throw Exception Vs Throw New Exception Kerri ASP .Net 2 10-27-2003 02:13 PM



Advertisments