admin@glassfish.java.net

Re: CODE REVIEW: FindBugs: admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt

From: Bill Shannon <bill.shannon_at_sun.com>
Date: Fri, 04 May 2007 00:47:32 -0700

Lloyd L Chambers wrote:
> Index:
> admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/SMFService.java
> ===================================================================
> RCS file:
> /cvs/glassfish/admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/SMFService.java,v
> retrieving revision 1.13
> diff -w -u -r1.13 SMFService.java
> ---
> admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/SMFService.java
> 2 May 2007 06:35:02 -0000 1.13
> +++
> admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/SMFService.java
> 3 May 2007 18:54:11 -0000
> @@ -52,7 +52,7 @@
> * @see #isConfigValid
> * @see SMFServiceHandler
> */
> -public class SMFService implements Service {
> +public final class SMFService implements Service {
>
> public static final String DATE_CREATED_TN =
> "DATE_CREATED";
> public static final String SERVICE_NAME_TN = "NAME";
> @@ -537,12 +537,21 @@
> throw new RuntimeException(e);
> }
> 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?