Kedar, without a comment I think it still complains. But I wasn't
sure how to test it out (eg run FindBugs) so I did the "safe" thing
and made sure the FindBugs complaint would go away.
On May 4, 2007, at 1:12 AM, Kedar Mhaswade wrote:
>
>>>
>>> finally {
>>> - if (bis != null)
>>> + if (bis != null) {
>>> try {
>>> bis.close();
>>> - } catch(Exception ee) {}
>>> + } catch(Exception ee) {
>>> + IGNORE_EXCEPTION(ee);
>>> }
>>> }
>>> + }
>>> + }
>>> +
>>> +
>>> + private static void IGNORE_EXCEPTION(final Exception e ) {
>>> + // ignore
>>> + }
>>> +
>>> private boolean serviceNameExists(final String sn) {
>>> boolean exists = false;
>>> try {
>>>
>>
>> Usually it's enough to do:
>>
>> try {
>> ...
>> } catch (Exception ex) {
>> // ignore
>> }
>>
>> Did that not work here?
>>
> I wonder why it won't work here.
> Moreover, I still think that it is OK to leave it without even a
> comment, because
> this *particular* place is such a boiler-plate code. While doing
> any reading/writing
> of the streams you opened in a method, just make sure that you
> "finally" make an attempt to close
> them and if it fails -- tough luck.
>
> It is fine to document the code by putting a comment like //
> ignore, but in this
> repetitive pattern, it's OK to just squelch it as well.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>