Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #26272
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Sebastian <news@seyweiler.dyndns.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: unnecessary code in Oracle example? |
| Date | Thu, 10 Oct 2013 07:47:31 +0200 |
| Organization | albasani.net |
| Lines | 35 |
| Message-ID | <l35f01$nhn$1@news.albasani.net> (permalink) |
| References | <ydnr4bujt72.fsf@shell.xmission.com> <u6h5u.69447$yx6.64233@fx26.iad> <ydneh7ujm7q.fsf@shell.xmission.com> <l34an4$ic1$1@dont-email.me> <ydna9iijivg.fsf@shell.xmission.com> <l34jek$782$1@dont-email.me> <ydn61t5kf4p.fsf@shell.xmission.com> <l35bcq$h7b$1@news.dialog.net.pl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.albasani.net P044ZDoF7NsT5hLYwmqAIaox51MO2v4qzCrOFNQYRpV40tJtXAjJI5SD3a0xI6zXmLagHCdGGfrZnmhPIoEu8lATNG5BjisteqMQ66J8F/pmHypsfFq3VYLhiPqHDukn |
| NNTP-Posting-Date | Thu, 10 Oct 2013 05:46:41 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="i794GuDrbDADJjsAPLCDkAHWcky7Ux4mFfZH1BadKWvEqkGQ+YDOhLRQn3QdvWEFawTvjAf7m8lgOPsm4Z9mxQ2XynGPzAYxKYAlCydN7HCgmFb6Q7bmSqSrGx4fAFXI"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
| In-Reply-To | <l35bcq$h7b$1@news.dialog.net.pl> |
| Cancel-Lock | sha1:unc8wWiUTTYI5y6PZ2YxsYBFQ50= |
| Xref | csiph.com comp.lang.java.programmer:26272 |
Show key headers only | View raw
Am 10.10.2013 06:42, schrieb Arivald:
> W dniu 2013-10-10 04:56, Jim Janney pisze:
>> markspace <markspace@nospam.nospam> writes:
>>
>>> On 10/9/2013 1:21 PM, Jim Janney wrote:
>>>> Yes, in Java 7 you can have clean syntax and clean semantics. Looks
>>>> like a win all around.
>>>>
>>>
>>> For Java 5+, with varargs you could do (not compiled):
> [...]
>>
>> Mmm... you're complicating the code with extra assignments and tests,
>> just to avoid one layer of nesting. I like the version with two
>> try-finally blocks, partly because the lexical structure reflects what's
>> happening in the code: two independent cleanups. But the Java 7 version
>> is better.
>>
>
> I wonder how Java 7 version (try-with-resources) handle exceptions...
> For example, if all 3 streams throw exception from close(), will it
> guarantee to close all of them? And how to handle such exceptions?
>
Why don't you modify markspace's example to see for yourself, e. g.
@Override
public void close() throws IOException {
System.out.println( "Trying to close "
+ getClass().getSimpleName()+":"+name );
throw new IOException("CloseError " + name);
}
Then read what the Javadocs have to say about suppressed exceptions.
-- Sebastian
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
unnecessary code in Oracle example? Jim Janney <jjanney@shell.xmission.com> - 2013-10-09 10:38 -0600
Re: unnecessary code in Oracle example? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-10-09 11:19 -0700
Re: unnecessary code in Oracle example? ram@zedat.fu-berlin.de (Stefan Ram) - 2013-10-09 19:04 +0000
Re: unnecessary code in Oracle example? Jim Janney <jjanney@shell.xmission.com> - 2013-10-09 13:08 -0600
Re: unnecessary code in Oracle example? markspace <markspace@nospam.nospam> - 2013-10-09 12:27 -0700
Re: unnecessary code in Oracle example? Jim Janney <jjanney@shell.xmission.com> - 2013-10-09 14:21 -0600
Re: unnecessary code in Oracle example? markspace <markspace@nospam.nospam> - 2013-10-09 14:56 -0700
Re: unnecessary code in Oracle example? Jim Janney <jjanney@shell.xmission.com> - 2013-10-09 20:56 -0600
Re: unnecessary code in Oracle example? Arivald <NOSPAMarivald@interia.pl> - 2013-10-10 06:42 +0200
Re: unnecessary code in Oracle example? Sebastian <news@seyweiler.dyndns.org> - 2013-10-10 07:47 +0200
Re: unnecessary code in Oracle example? Arivald <arivald_@AT_interia_DOT_.pl> - 2013-10-10 10:26 +0200
Re: unnecessary code in Oracle example? Jim Janney <jjanney@shell.xmission.com> - 2013-10-10 08:47 -0600
Re: unnecessary code in Oracle example? Robert Klemme <shortcutter@googlemail.com> - 2013-10-09 21:11 +0200
Re: unnecessary code in Oracle example? cuzdav@gmail.com - 2013-10-10 08:49 -0700
csiph-web