Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36613
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Eclipse doesn't like else |
| Date | 2017-05-13 20:39 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <of88ve$1ubv$1@gioia.aioe.org> (permalink) |
| References | <3c792901-a05d-4a02-b058-20b9e0576095@googlegroups.com> <of4v05$j60$1@gwaiyur.mb-net.net> <2a413b82-4d1c-467f-bd6b-ad8e6534ba81@googlegroups.com> |
On 5/12/2017 2:53 PM, Eric Douglas wrote: > On Friday, May 12, 2017 at 2:30:37 PM UTC-4, Marcel Mueller wrote: >> Eclispe is right. Your code is not exception safe. If an >> SQLException is thrown close will not be executed. close should >> always be called from a finally block. Marcel > > Which seems odd that it doesn't complain if you take out the 3 lines > above the if, or if you pass the query as a variable so you can > execute those 2 prepareStatement commands as one after the if, either > of which would still produce the resource leak if it hits the catch > clause. I don't think Eclipse detects all cases of resource leak. It is still your responsibility. Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Eclipse doesn't like else Eric Douglas <e.d.programmer@gmail.com> - 2017-05-12 10:44 -0700
Re: Eclipse doesn't like else Marcel Mueller <news.5.maazl@spamgourmet.org> - 2017-05-12 20:30 +0200
Re: Eclipse doesn't like else Eric Douglas <e.d.programmer@gmail.com> - 2017-05-12 11:53 -0700
Re: Eclipse doesn't like else Arne Vajhøj <arne@vajhoej.dk> - 2017-05-13 20:39 -0400
Re: Eclipse doesn't like else v_borchert@despammed.com (Volker Borchert) - 2017-05-14 03:50 +0000
Re: Eclipse doesn't like else v_borchert@despammed.com (Volker Borchert) - 2017-05-12 18:15 +0000
Re: Eclipse doesn't like else Eric Douglas <e.d.programmer@gmail.com> - 2017-05-12 13:33 -0700
Re: Eclipse doesn't like else Martin Gregorie <martin@address-in-sig.invalid> - 2017-05-12 21:22 +0000
Re: Eclipse doesn't like else v_borchert@despammed.com (Volker Borchert) - 2017-05-13 00:52 +0000
Re: Eclipse doesn't like else Arne Vajhøj <arne@vajhoej.dk> - 2017-05-13 21:04 -0400
csiph-web