webtier@glassfish.java.net

Re: [webtier] fix for issue 7947 - disabling of HTTP listeners leads to ArithmeticException

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Tue, 21 Apr 2009 17:53:29 -0700

On 04/21/09 04:32 PM, Dies Koper wrote:
> Hi Jan,
>
> Thanks for fixing the other issue! I'll have a look at your diffs.
>
> About the issue I just raised (issue #7947), an easy fix would be to
> just add a 0 check (see attachment).
>
> I could not reproduce the error on just the DAS, and I'm not sure the
> Monitoring page should be showing disabled HTTP listeners at all, but
> the source code (both in V2.1 and V3) is asking for an
> ArithmeticException to occur, so I think this patch is a good start.
>

Looks great. Dies!

Minor recommendation: I think you can simplify the patch as follows:

Index: stats/StatsUtil.java
===================================================================
RCS file:
/cvs/glassfish/appserv-core/src/java/com/sun/enterprise/web/stats/StatsUtil.java,v
retrieving revision 1.8
diff -u -r1.8 StatsUtil.java
--- stats/StatsUtil.java 5 May 2007 05:36:07 -0000 1.8
+++ stats/StatsUtil.java 22 Apr 2009 00:50:45 -0000
@@ -230,7 +230,7 @@
             }
         }

- return total/num;
+ return (num > 0 ? total/num : 0);
     }



Can you please commit to SJSAS91_FCS_BRANCH, or would you like me to do
this on your behalf?

Thanks!

Jan



> Regards,
> Dies
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net