From 96516fc9d8e427329e435c2d91867ed95d023670 Mon Sep 17 00:00:00 2001 From: orbiter Date: Wed, 13 Apr 2005 11:16:31 +0000 Subject: [PATCH] fixed bugs (search+kelondroException, dns) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@16 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpc.java | 14 +---- .../de/anomic/kelondro/kelondroException.java | 2 +- source/de/anomic/plasma/plasmaSearch.java | 62 ++++++++++++++++--- yacy.stopwords | 1 - 4 files changed, 55 insertions(+), 24 deletions(-) diff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.java index 747caa9e6..820e29c04 100644 --- a/source/de/anomic/http/httpc.java +++ b/source/de/anomic/http/httpc.java @@ -98,7 +98,7 @@ public class httpc { java.security.Security.setProperty("networkaddress.cache.negative.ttl" , "0"); } - private static String dnsResolveX(String host) { + public static String dnsResolve(String host) { // looks for the ip of host and returns ip number as string String ip = (String) nameCacheHit.get(host); if (ip != null) return ip; @@ -116,18 +116,6 @@ public class httpc { } return null; } - - public static String dnsResolve(String host) { - String ip = null; - for (int i = 0; i < 50; i++) { - ip = dnsResolveX(host); - if (ip != null) { - //if (i > 0) System.out.println(i + " attempts for " + host); - return ip; - } - } - return ip; - } public static boolean dnsFetch(String host) { // looks for the ip of host and returns false if the host was in the cache diff --git a/source/de/anomic/kelondro/kelondroException.java b/source/de/anomic/kelondro/kelondroException.java index 57a617355..7a11df80e 100644 --- a/source/de/anomic/kelondro/kelondroException.java +++ b/source/de/anomic/kelondro/kelondroException.java @@ -49,7 +49,7 @@ public class kelondroException extends java.lang.RuntimeException { } public kelondroException(String database, String message) { - super(message + " in database '" + database + "'"); + super(message + " in db '" + database + "'"); } } diff --git a/source/de/anomic/plasma/plasmaSearch.java b/source/de/anomic/plasma/plasmaSearch.java index 3019a6efe..e576edc1a 100644 --- a/source/de/anomic/plasma/plasmaSearch.java +++ b/source/de/anomic/plasma/plasmaSearch.java @@ -211,9 +211,15 @@ public class plasmaSearch { Enumeration se = small.elements(true); plasmaWordIndexEntry ie; long stamp = System.currentTimeMillis(); - while ((se.hasMoreElements()) && ((System.currentTimeMillis() - stamp) < time)) { - ie = (plasmaWordIndexEntry) se.nextElement(); - if (large.contains(ie)) conj.addEntry(ie); + try { + while ((se.hasMoreElements()) && ((System.currentTimeMillis() - stamp) < time)) { + ie = (plasmaWordIndexEntry) se.nextElement(); + if (large.contains(ie)) conj.addEntry(ie); + } + } catch (kelondroException e) { + serverLog.logError("PLASMA", "joinConstructiveByTest: Database corrupt (" + e.getMessage() + "), deleting index"); + small.deleteComplete(); + return conj; } return conj; } @@ -225,20 +231,58 @@ public class plasmaSearch { Enumeration e2 = i2.elements(true); int c; if ((e1.hasMoreElements()) && (e2.hasMoreElements())) { - plasmaWordIndexEntry ie1 = (plasmaWordIndexEntry) e1.nextElement(); - plasmaWordIndexEntry ie2 = (plasmaWordIndexEntry) e2.nextElement(); + plasmaWordIndexEntry ie1; + plasmaWordIndexEntry ie2; + try { + ie1 = (plasmaWordIndexEntry) e1.nextElement(); + } catch (kelondroException e) { + serverLog.logError("PLASMA", "joinConstructiveByEnumeration: Database corrupt 1 (" + e.getMessage() + "), deleting index"); + i1.deleteComplete(); + return conj; + } + try { + ie2 = (plasmaWordIndexEntry) e2.nextElement(); + } catch (kelondroException e) { + serverLog.logError("PLASMA", "joinConstructiveByEnumeration: Database corrupt 2 (" + e.getMessage() + "), deleting index"); + i2.deleteComplete(); + return conj; + } long stamp = System.currentTimeMillis(); while ((System.currentTimeMillis() - stamp) < time) { c = ie1.getUrlHash().compareTo(ie2.getUrlHash()); if (c < 0) { - if (e1.hasMoreElements()) ie1 = (plasmaWordIndexEntry) e1.nextElement(); else break; + try { + if (e1.hasMoreElements()) ie1 = (plasmaWordIndexEntry) e1.nextElement(); else break; + } catch (kelondroException e) { + serverLog.logError("PLASMA", "joinConstructiveByEnumeration: Database 1 corrupt (" + e.getMessage() + "), deleting index"); + i1.deleteComplete(); + break; + } } else if (c > 0) { - if (e2.hasMoreElements()) ie2 = (plasmaWordIndexEntry) e2.nextElement(); else break; + try { + if (e2.hasMoreElements()) ie2 = (plasmaWordIndexEntry) e2.nextElement(); else break; + } catch (kelondroException e) { + serverLog.logError("PLASMA", "joinConstructiveByEnumeration: Database 2 corrupt (" + e.getMessage() + "), deleting index"); + i2.deleteComplete(); + break; + } } else { // we have found the same urls in different searches! conj.addEntry(ie1); - if (e1.hasMoreElements()) ie1 = (plasmaWordIndexEntry) e1.nextElement(); else break; - if (e2.hasMoreElements()) ie2 = (plasmaWordIndexEntry) e2.nextElement(); else break; + try { + if (e1.hasMoreElements()) ie1 = (plasmaWordIndexEntry) e1.nextElement(); else break; + } catch (kelondroException e) { + serverLog.logError("PLASMA", "joinConstructiveByEnumeration: Database 1 corrupt (" + e.getMessage() + "), deleting index"); + i1.deleteComplete(); + break; + } + try { + if (e2.hasMoreElements()) ie2 = (plasmaWordIndexEntry) e2.nextElement(); else break; + } catch (kelondroException e) { + serverLog.logError("PLASMA", "joinConstructiveByEnumeration: Database 2 corrupt (" + e.getMessage() + "), deleting index"); + i2.deleteComplete(); + break; + } } } } diff --git a/yacy.stopwords b/yacy.stopwords index 99da3c6bb..f765f1320 100644 --- a/yacy.stopwords +++ b/yacy.stopwords @@ -519,7 +519,6 @@ perhaps post privat private -problem prof put quite