From 5b3e01bd3ce47f5ebe9a04a3975999970fed76b1 Mon Sep 17 00:00:00 2001 From: hermens Date: Tue, 20 Dec 2005 12:03:34 +0000 Subject: [PATCH] avoid division by zero when importing very small indexes (<100 entries) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1238 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/plasma/plasmaDbImporter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/de/anomic/plasma/plasmaDbImporter.java b/source/de/anomic/plasma/plasmaDbImporter.java index e6170b00a..797151093 100644 --- a/source/de/anomic/plasma/plasmaDbImporter.java +++ b/source/de/anomic/plasma/plasmaDbImporter.java @@ -198,7 +198,10 @@ public class plasmaDbImporter extends Thread { } public int getProcessingStatus() { - return (this.importStartSize-this.importWordIndex.size())/(this.importStartSize/100); + // thid seems to be better: + // (this.importStartSize-this.importWordIndex.size())*100/((this.importStartSize==0)?1:this.importStartSize); + // but maxint (2,147,483,647) could be exceeded when WordIndexes reach 20M entries + return (this.importStartSize-this.importWordIndex.size())/((this.importStartSize<100)?1:(this.importStartSize)/100); } public long getElapsedTime() {