Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exception handling

Status
Not open for further replies.

D4VEHUG

Technical User
Mar 5, 2004
6
0
0
GB
I have written a Java class that throws an IOException from within a 'while' loop.

If an IOException is thrown, (and caught), I wish to increment a Static variable and then resume (jump back to) where the exception was thrown from.

How do I achieve this?

I am assuming there is something I can include in the exception handler.

Any help will be most gratefully received.
 
I think you have to put a 'try/catch' around every single statement that can throw an exception and just fall through (continue with the statement after the catch block). I don't think there is a "clean" way to jump back.
This is a pure java question, on forum269 you will get more answers faster.
 
something maybe a little like :

Code:
while (somecondition) {
  try {
    someOperation();
  } catch (IOException ioe) {
     bla++;
     continue;
  }
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top