admin@glassfish.java.net

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

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Fri, 04 May 2007 09:01:12 -0700

Bill,

I've used the comment technique before, but I felt that by using a
dummy method, future searches could be done to find such places. In
this case, one can argue that the code is boilerplate, but as I was
fixing several files, it made sense to use the same technique.

Lloyd

On May 4, 2007, at 12:47 AM, Bill Shannon wrote:

> 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?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>