Re: Do you need finally when your method throws Exception..
- From: steve <steve@xxxxxxx>
- Date: Sun, 2 Oct 2005 06:17:40 +0800
On Fri, 30 Sep 2005 04:50:13 +0800, zero wrote
(in article <Xns96E0E84BBAEEzerothishi@xxxxxxxxxxxxxx>):
> Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx> wrote in
> news:sikoj11ghakm7kufces5c369u8iip78po8@xxxxxxx:
>
>> On Thu, 29 Sep 2005 18:29:55 GMT, zero <zero@xxxxxxx> wrote or quoted
>>>
>>
>>> if(resource == null)
>>> resource.close();
>> you meant to say
>>
>> if ( resource != null )
>> {
>> resource.close();
>> }
>
> oops, of course. Thanks for the correction :-)
actually it is going to be more like:
if ( resource != null ){
try{
resource.close();
}
catch(Exception e)
{
System.out.println("serious error , failed to close resource XYZ");
e.printStackTrace();
}
finally
{
// this is supposed to be empty
}
.
- Follow-Ups:
- Re: Do you need finally when your method throws Exception..
- From: Roedy Green
- Re: Do you need finally when your method throws Exception..
- Prev by Date: Re: resize JTable
- Next by Date: Re: how to print a string in binary
- Previous by thread: Re: resize JTable
- Next by thread: Re: Do you need finally when your method throws Exception..
- Index(es):
Relevant Pages
|