Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Catching mulitple Exceptions in JDK 1.7 Date: Fri, 29 Jul 2011 09:28:43 -0700 Organization: A noiseless patient Spider Lines: 31 Message-ID: References: <26n5371g476s9v7gu55utlpn7c6cf363k5@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 29 Jul 2011 16:28:46 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="2669"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3l5Cj3ab0jp+EkO68jDBoxm+FR2w1F0c=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <26n5371g476s9v7gu55utlpn7c6cf363k5@4ax.com> Cancel-Lock: sha1:Rc2BNCsxFiSE1SZf3aKlgEQmrHs= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6658 On 7/29/2011 9:18 AM, Roedy Green wrote: > On Fri, 29 Jul 2011 09:14:28 -0700, Roedy Green > 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.