Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #12856
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Strange Socket Problem Solved! |
| References | <jjegsf$746$1@dont-email.me> |
| Message-ID | <IYP6r.31308$Ai4.9849@newsfe18.iad> (permalink) |
| Date | 2012-03-10 13:46 -0800 |
On 3/9/12 7:13 PM, Knute Johnson wrote: > I want to thank everybody that gave me ideas to help me find my problem > with my program. It turns out that the problem was bad data throwing a > RuntimeException in the thread, bringing it to a stop. I probably should > have programmed it with bad data in mind but I didn't. We had an > agreement on format and that was supposed to be that. I had some simple > format checks but no protection for the Exception. > > I haven't seen the actual bad record yet but I put in traps for it and > will have the offender soon. > > Thanks again everybody. > The lesson here should be that any "infinite loop" that you want to truly be infinite should have a "catch RuntimeException" inside of it. Unless you want an exception to end the loop. The nature of RuntimeException is that you never know what downstream code is going to throw it, and should be willing to handle it if you need to. On the other hand, "Bad data" should probably through a checked exception. I often try to differentiate checked vs unchecked as "Something that I have no control of, but should be reported", vs "Indication of a bug in the code." Of course, this isn't always the case, but often should be.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Strange Socket Problem Solved! Knute Johnson <nospam@knutejohnson.com> - 2012-03-09 19:13 -0800
Re: Strange Socket Problem Solved! Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-10 13:46 -0800
Re: Strange Socket Problem Solved! Knute Johnson <nospam@knutejohnson.com> - 2012-03-10 16:55 -0800
csiph-web