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


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

Re: Catching mulitple Exceptions in JDK 1.7

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Catching mulitple Exceptions in JDK 1.7
Date 2011-07-29 09:28 -0700
Organization A noiseless patient Spider
Message-ID <j0un3u$2jd$1@dont-email.me> (permalink)
References <ivm537l6o5sq61oo6cigbrkb4ti8ujmibf@4ax.com> <26n5371g476s9v7gu55utlpn7c6cf363k5@4ax.com>

Show all headers | View raw


On 7/29/2011 9:18 AM, Roedy Green wrote:
> On Fri, 29 Jul 2011 09:14:28 -0700, Roedy Green
> <see_website@mindprod.com.invalid>  wrote, quoted or indirectly quoted
> someone who said :
>
>> 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?
>
> Let's say you have an IOException. When you log ex, what are you
> logging?  There IS no SQLException to log.


This is probably just a temporary error in thinking, but IOExcpetion 
doesn't define any additional methods or properties beyond what 
Exception defines (I'm ignoring "parameters").  So no worries there.

As for what you are logging, it's "ex."

>
> It would have thought type of ex would have to be the deepest common
> class of the two exceptions.


Probably Exception.  At least must be Throwable.  No I don't have a 
revised JLS handy, I'll take a look.

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