Skip to main content

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

3 replies [Last post]
Anonymous

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.

Regards,
Dies
Index: 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
--- StatsUtil.java 5 May 2007 05:36:07 -0000 1.8
+++ StatsUtil.java 13 Feb 2009 12:51:54 -0000
@@ -229,8 +229,13 @@
num++;
}
}
-
- return total/num;
+
+ int result = 0;
+ if (0 < num) {
+ result = total/num;
+ }
+
+ return result;
}

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jan Luehe

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@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net

[att1.html]

Dies Koper

Hi Jan,

I can commit it in SJSAS91_FCS_BRANCH today, and I'll wait a few days
for V3 (after published MS2 promotion).

Thanks,
Dies

Jan Luehe wrote:
> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Jan Luehe

Hi Dies,

On 04/21/09 06:04 PM, Dies Koper wrote:
> Hi Jan,
>
> I can commit it in SJSAS91_FCS_BRANCH today, and I'll wait a few days
> for V3 (after published MS2 promotion).
Sounds great!

Jan

>
> Thanks,
> Dies
>
>
> Jan Luehe wrote:
>> 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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net