Skip to content

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

fix for http://forum.yacy-websuche.de/viewtopic.php?f=6&t=394&p=2382#p2382

orbiter143fa40d7735
diff --git a/source/de/anomic/index/indexRAMRI.java b/source/de/anomic/index/indexRAMRI.java
index 06d869567..573f97efd 100644
--- a/source/de/anomic/index/indexRAMRI.java
+++ b/source/de/anomic/index/indexRAMRI.java
@@ -392,7 +392,8 @@ public final class indexRAMRI implements indexRI {
}
public synchronized indexContainer getContainer(String wordHash, Set urlselection) {
-
+ if (wordHash == null) return null;
+
// retrieve container
indexContainer container = (indexContainer) cache.get(wordHash);
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index b1adbf3a5..ad5a9db54 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -192,13 +192,12 @@ public final class plasmaWordIndex implements indexRI {
}
private void flushCache(indexRAMRI ram, int count) {
- if (ram.size() <= count) count = ram.size();
- if (count <= 0) return;
- if (count > 5000) count = 5000;
busyCacheFlush = true;
String wordHash;
ArrayList containerList = new ArrayList();
synchronized (ram) {
+ count = Math.min(5000, Math.min(count, ram.size()));
+ if (count <= 0) return;
boolean collectMax = true;
indexContainer c;
while (collectMax) {