Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed a cache-bug in cachedFileRA
orbiteref7fe537c52f
diff --git a/source/de/anomic/kelondro/kelondroCachedFileRA.java b/source/de/anomic/kelondro/kelondroCachedFileRA.javaindex 0df0b8c32..8f9c6c8dd 100644--- a/source/de/anomic/kelondro/kelondroCachedFileRA.java+++ b/source/de/anomic/kelondro/kelondroCachedFileRA.java@@ -94,7 +94,13 @@ public final class kelondroCachedFileRA extends kelondroAbstractRA implements kepublic synchronized void write(final byte[] b, final int off, final int len) throws IOException {//assert len > 0;// write to file- if (this.cache.length > 512) this.cache = new byte[512]; // the large cache is only useful during an initialization phase+ if (this.cache.length > 512) {+ // the large cache is only useful during an initialization phase+ byte[] newcache = new byte[512];+ System.arraycopy(this.cache, 0, newcache, 0, newcache.length);+ this.cache = newcache;+ if (this.cachelen > this.cache.length) this.cachelen = this.cache.length;+ }long seekpos = this.RAFile.getFilePointer();if (this.cachelen + len <= this.cache.length && this.cachestart + this.cachelen == seekpos) {// append to cache