From 9d8b32c63a782b8431105745eff06c530496cbbc Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 4 Dec 2013 01:54:14 +0100 Subject: [PATCH] fixed a division by zero --- htroot/ConfigHTCache_p.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htroot/ConfigHTCache_p.java b/htroot/ConfigHTCache_p.java index 48d4df623..133ae4b74 100644 --- a/htroot/ConfigHTCache_p.java +++ b/htroot/ConfigHTCache_p.java @@ -79,7 +79,7 @@ public class ConfigHTCache_p { prop.put("HTCachePath", env.getConfig(SwitchboardConstants.HTCACHE_PATH, SwitchboardConstants.HTCACHE_PATH_DEFAULT)); prop.put("actualCacheSize", Cache.getActualCacheSize() / 1024 / 1024); prop.put("actualCacheDocCount", Cache.getActualCacheDocCount()); - prop.put("docSizeAverage", Cache.getActualCacheSize() / Cache.getActualCacheDocCount() / 1024); + prop.put("docSizeAverage", Cache.getActualCacheDocCount() == 0 ? 0 : Cache.getActualCacheSize() / Cache.getActualCacheDocCount() / 1024); prop.put("maxCacheSize", env.getConfigLong(SwitchboardConstants.PROXY_CACHE_SIZE, 64)); // return rewrite properties return prop;