Skip to content

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

fix for http://www.yacy-forum.de/viewtopic.php?p=10026#10026

orbiter18d9e1a256f4
diff --git a/source/de/anomic/kelondro/kelondroRecords.java b/source/de/anomic/kelondro/kelondroRecords.java
index 1ccb2c9ba..5f4cad9f5 100644
--- a/source/de/anomic/kelondro/kelondroRecords.java
+++ b/source/de/anomic/kelondro/kelondroRecords.java
@@ -333,6 +333,11 @@ public class kelondroRecords {
this.XcacheStartup = System.currentTimeMillis();
}
+ public File file() {
+ if (filename == null) return null;
+ return new File(filename);
+ }
+
private int cacheChunkSize(boolean cacheControl) {
return this.headchunksize + element_in_cache + ((cacheControl) ? cache_control_entry : 0);
}
diff --git a/source/de/anomic/plasma/plasmaWordIndexEntity.java b/source/de/anomic/plasma/plasmaWordIndexEntity.java
index 6030b5d36..aa15978e5 100644
--- a/source/de/anomic/plasma/plasmaWordIndexEntity.java
+++ b/source/de/anomic/plasma/plasmaWordIndexEntity.java
@@ -49,6 +49,7 @@ import java.util.TreeMap;
import de.anomic.kelondro.kelondroRecords;
import de.anomic.kelondro.kelondroTree;
+import de.anomic.kelondro.kelondroException;
public class plasmaWordIndexEntity {
@@ -237,18 +238,29 @@ public class plasmaWordIndexEntity {
public class dbenum implements Enumeration {
Iterator i;
public dbenum(boolean up) {
- i = theIndex.nodeIterator(up, false);
+ try {
+ i = theIndex.nodeIterator(up, false);
+ } catch (kelondroException e) {
+ e.printStackTrace();
+ theIndex.file().delete();
+ i = null;
+ }
}
public boolean hasMoreElements() {
- return i.hasNext();
+ return (i != null) && (i.hasNext());
}
public Object nextElement() {
+ if (i == null) return null;
try {
byte[][] n = ((kelondroRecords.Node) i.next()).getValues();
return new plasmaWordIndexEntry(new String(n[0]), new String(n[1]));
} catch (IOException e) {
+ i = null;
throw new RuntimeException("dbenum: " + e.getMessage());
- }
+ } catch (kelondroException e) {
+ i = null;
+ throw new RuntimeException("dbenum: " + e.getMessage());
+ }
}
}
public class tmpenum implements Enumeration {