Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #18683
| From | markspace <-@.> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: can't throw |
| Date | 2012-09-12 10:56 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <k2qic4$jpf$1@dont-email.me> (permalink) |
| References | (1 earlier) <k2o8sm$ve3$1@dont-email.me> <fea53dab-0659-4f9f-af44-c181c4508aa1@googlegroups.com> <504fe3a6$0$293$14726298@news.sunsite.dk> <zy7f3qajj0sa.u9hsothk0nnw$.dlg@40tude.net> <c5d15859hljg2lsi58vh2hci8vm7ip7kpl@4ax.com> |
On 9/12/2012 9:18 AM, Gene Wirchenko wrote:
> I prefer reading the main flow of execution as a high-level
> story. Catches interrupt this. When there are a lot of catches, they
> make the main code harder to find.
Well true, but these sorts of things yield easily to a little thought
and planning.
Given some method or collection of methods that throw a lot of
exceptions, throwsALot(), you can just separate out the exception
handling from the rest of the code.
private void implementation()
throws This, That, Another
{
throwsALot();
}
public void handlers() {
try {
implementation();
} catch( This ex ) {
} catch( That ex ) {
} catch( Another ex ) {
}
Now at least your bothersome exception handling is separate from your
implementation, and you can read the code a bit more easily. One
exception in Java 7 is probably AutoClosable, which you should probably
take advantage of when available.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
can't throw bob smith <bob@coolfone.comze.com> - 2012-09-11 13:16 -0700
Re: can't throw markspace <-@.> - 2012-09-11 13:34 -0700
Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-11 14:15 -0700
Re: can't throw Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-11 17:02 -0400
Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-11 14:17 -0700
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-11 21:21 -0400
Re: can't throw Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-09-11 21:59 -0700
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-12 09:18 -0700
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-12 19:09 +0200
Re: can't throw markspace <-@.> - 2012-09-12 10:56 -0700
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:36 -0400
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-12 18:29 -0700
Re: can't throw Patricia Shanahan <pats@acm.org> - 2012-09-12 18:34 -0700
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 21:37 -0400
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 21:54 -0400
Re: can't throw Jim Janney <jjanney@shell.xmission.com> - 2012-09-12 11:27 -0600
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:24 -0400
Re: can't throw Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-09-13 22:20 -0700
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-14 09:49 -0700
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-14 20:50 +0200
Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-14 13:02 -0700
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-14 14:06 -0700
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-14 13:16 -0700
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-14 23:07 +0200
Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-14 14:28 -0700
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-16 20:04 -0700
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:16 -0400
Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-12 23:15 -0700
Re: can't throw Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-14 17:33 -0500
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-16 15:46 +0200
Re: can't throw Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-16 12:17 -0500
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-16 22:36 +0200
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-16 20:07 -0700
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-17 07:41 +0200
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-17 09:51 -0700
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-17 21:00 +0200
Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-17 13:23 -0700
Re: can't throw Joerg Meier <joergmmeier@arcor.de> - 2012-09-17 18:52 +0200
Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-17 11:22 -0700
Re: can't throw Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-17 02:52 -0500
Re: can't throw Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-17 02:39 -0500
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-17 21:02 +0200
Re: can't throw markspace <-@.> - 2012-09-11 14:28 -0700
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-11 21:14 -0400
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:11 -0400
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-12 08:31 +0200
Re: can't throw bob smith <bob@coolfone.comze.com> - 2012-09-12 11:40 -0700
Re: can't throw Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-12 15:50 -0400
Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-12 12:52 -0700
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-12 23:24 +0200
Re: can't throw Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-09-12 15:10 -0700
Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-13 23:32 +0200
Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:06 -0400
Re: can't throw Roedy Green <see_website@mindprod.com.invalid> - 2012-09-12 20:55 -0700
csiph-web