Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6701

Re: Catching mulitple Exceptions in JDK 1.7

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!fi.sn.net!newsfeed1.tdcnet.fi!news.song.fi!not-for-mail
From Jukka Lahtinen <jtfjdehf@hotmail.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Catching mulitple Exceptions in JDK 1.7
Organization none
References <ivm537l6o5sq61oo6cigbrkb4ti8ujmibf@4ax.com>
X-no-archive yes
Content-Type text/plain;charset="iso-8859-1"
Content-Transfer-Encoding 8bit
Date Sun, 31 Jul 2011 10:48:15 +0300
Message-ID <m362miriv4.fsf@despammed.com> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Cancel-Lock sha1:3lA8jZ/w1dafOjQPtsg4hCOaFy4=
MIME-Version 1.0
Lines 21
NNTP-Posting-Host 81.17.207.67
X-Trace 1312098494 news.tdc.fi 3074 81.17.207.67:35092
X-Complaints-To abuse@tdcnet.fi
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6701

Show key headers only | View raw


Roedy Green <see_website@mindprod.com.invalid> writes:

> catch (IOException|SQLException ex) {
>     logger.log(ex);
>     throw ex;
> }
>
> Is it correct to say that I can't get at any of the parameters of the
> IOException if I use the new JDK 1.7 multiple catch?

if (ex instanceof IOException) {
  IOException ioe = (IOException) ex;
  ...
}

Of course, if you need something in the catch block that is specific to
IOException, you probably wouldn't do
catch (IOException|SQLException ex)

-- 
Jukka Lahtinen

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Catching mulitple Exceptions in JDK 1.7 Roedy Green <see_website@mindprod.com.invalid> - 2011-07-29 09:14 -0700
  Re: Catching mulitple Exceptions in JDK 1.7 Roedy Green <see_website@mindprod.com.invalid> - 2011-07-29 09:18 -0700
    Re: Catching mulitple Exceptions in JDK 1.7 markspace <-@.> - 2011-07-29 09:28 -0700
  Re: Catching mulitple Exceptions in JDK 1.7 Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2011-07-31 10:48 +0300
    Re: Catching mulitple Exceptions in JDK 1.7 Lew <lewbloch@gmail.com> - 2011-08-01 23:54 -0700
      Re: Catching mulitple Exceptions in JDK 1.7 Roedy Green <see_website@mindprod.com.invalid> - 2011-08-02 06:56 -0700
        Re: Catching mulitple Exceptions in JDK 1.7 Patricia Shanahan <pats@acm.org> - 2011-08-02 14:07 -0700
          Re: Catching mulitple Exceptions in JDK 1.7 supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-08-03 23:31 -0400
            Re: Catching mulitple Exceptions in JDK 1.7 Patricia Shanahan <pats@acm.org> - 2011-08-03 21:03 -0700
          Re: Catching mulitple Exceptions in JDK 1.7 Jeff Higgins <jeff@invalid.invalid> - 2011-08-05 19:02 -0400
            Re: Catching mulitple Exceptions in JDK 1.7 Patricia Shanahan <pats@acm.org> - 2011-08-06 09:45 -0700
        Re: Catching mulitple Exceptions in JDK 1.7 Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2011-08-03 00:11 +0300

csiph-web