quality@glassfish.java.net

Re: Findbugs update.

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 26 Apr 2006 17:07:55 -0700

Hi Aditya,

Aditya Dada wrote On 04/26/06 16:54,:
> Sometime ago, I blogged about findbugs, and its use on glassfish. (see:
> http://weblogs.java.net/blog/aditya_dada/)
> Findbugs tool has been very helpful in finding out high priority issues
> like infinite loops. In the past, and with the help of Jerome Dochez, we
> were able to inform the teams whose code included an infinite loop, and
> get it corrected. Some infinite loops present in the third-party code is
> still out of our scope to get fixed during timeframes that suit us. We
> have been able to reduce the number from an all time high of 8 to 4,
> now. For those interested, here are the culprits that still remain in
> Glassfish code:
>
> Infinite Loop #1
> In class com.sun.messaging.jmq.util.CacheHashMap
> In method com.sun.messaging.jmq.util.CacheHashMap.capacity()
> At CacheHashMap.java:[line 43]
>
> Infinite Loop #2
> In class com.sun.org.apache.commons.modeler.Registry
> In method
> com.sun.org.apache.commons.modeler.Registry.setServer(javax.management.MBeanServer)
>
> At Registry.java:[line 551]

I've compared com.sun.org.apache.commons.modeler.Registry with the
commons-modeler sources @Apache, and noticed the infinite loop has been
fixed there.

I will make a corresponding change to our local repository, as follows:

Index: Registry.java
===================================================================
RCS file:
/m/jws-mirror/jakarta-commons/com-sun-commons-modeler-1.1-src/src/java/com/sun/org/apache/commons/modeler/Registry.java,v
retrieving revision 1.1
diff -u -r1.1 Registry.java
--- Registry.java 28 Feb 2006 20:55:03 -0000 1.1
+++ Registry.java 27 Apr 2006 00:04:40 -0000
@@ -548,7 +548,7 @@
       * @deprecated Use the instance method
       */
      public static void setServer(MBeanServer mbeanServer) {
- Registry.getRegistry().setServer(mbeanServer);
+ Registry.getRegistry().setMBeanServer(mbeanServer);
      }

      /**

and will ask Terena to repromote commons-modeler.

Thanks,


Jan



>
> Infinite Loop #3
> In class com.sun.xml.stream.ZephyrWriterFactory
> In method
> com.sun.xml.stream.ZephyrWriterFactory.createXMLStreamWriter(javax.xml.transform.Result)
>
> At ZephyrWriterFactory.java:[line 85]
>
> Infinite Loop #4
> In class oracle.toplink.essentials.sessions.Project
> In method
> oracle.toplink.essentials.sessions.Project.getClassDescriptorForAlias(String)
>
> At Project.java:[line 778]
>
>
> While on the topic of FindBugs, I think it is appropriate to mention,
> and applaud, the effort of the JSF team, that found, and then fixed all
> high priority warnings found by Findbugs. Way to go JSF team!
>
> -Aditya
>