Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

avoid division by zero when importing very small indexes (<100 entries)

hermens5b3e01bd3ce4
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() {