This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I thought that there was a way to continue after a caught exception has been thrown. I.E. I have a program that reads thru a list of machine names, then goes out and sends some UDP packtes to it. If the machine is turned off, or has been renamed, I will get an UnknownHostException. What I want to know is, once I hit a bad machine, is there a way to go on thru the rest of the list rather than die right there. Ryan Headley
Ryan Headley<br /><a href="http://www.sudovi.com" target="_blank" rel="nofollow">http://www.sudovi.com</a>
I thought about that, but the minute it hits the Exception, the program dies. Or at least it seems to. However, the issue is a dead one now cause the problem was elsewhere...the name in the list was spelled wrong...heheh Ryan But now I am curious...I wonder if that would work...I am gonna hafta play with some code...
If you properly placed your try/catch block fully within the body of your loop, and it still seemed to die... perhaps you weren't catching the right exception? Sometimes it can throw more than one. If you catch (Exception e) < which is not recommended in 'real world' > Then you will know.
Joined: Jun 28, 2000
Coming to think of it, I am sure that was the problem. I'll just move the for loop... Thanx guys... Like I said earlier, it was a different issue that fixed it, but its probably good practice/syntax to move that loop! Thanx again