From 4282ad94e3c7696cdc74db7c2a39b0963ffc7cc7 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Fri, 4 Oct 2013 20:54:49 +0000 Subject: [PATCH] HTTPCLIENT-1413: Fixed divide by zero error in FutureRequestExecutionMetrics git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1529295 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/http/impl/client/FutureRequestExecutionMetrics.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionMetrics.java b/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionMetrics.java index 7ed48ba94..6428e388e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionMetrics.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionMetrics.java @@ -139,7 +139,7 @@ public final class FutureRequestExecutionMetrics { public long averageDuration() { final long counter = count.get(); - return cumulativeDuration.get() / counter; + return counter > 0 ? cumulativeDuration.get() / counter : 0; } @Override