fixed bugs:

- null pointer exception during startup of a robinson-configured peer
- wrong time calculation of default value of re-crawl option

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2005 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 0917890e80
commit bd283b8443

@ -329,13 +329,13 @@ public class IndexCreate_p {
prop.put("crawlingIfOlderNumber", 1); prop.put("crawlingIfOlderNumber", 1);
prop.put("crawlingIfOlderUnitYearCheck", 1); prop.put("crawlingIfOlderUnitYearCheck", 1);
} else if (crawlingIfOlder >= 60*24*365) { } else if (crawlingIfOlder >= 60*24*365) {
prop.put("crawlingIfOlderNumber", crawlingIfOlder / 60*24*365); prop.put("crawlingIfOlderNumber", crawlingIfOlder / (60*24*365));
prop.put("crawlingIfOlderUnitYearCheck", 1); prop.put("crawlingIfOlderUnitYearCheck", 1);
} else if (crawlingIfOlder >= 60*24*30) { } else if (crawlingIfOlder >= 60*24*30) {
prop.put("crawlingIfOlderNumber", crawlingIfOlder / 60*24*30); prop.put("crawlingIfOlderNumber", crawlingIfOlder / (60*24*30));
prop.put("crawlingIfOlderUnitMonthCheck", 1); prop.put("crawlingIfOlderUnitMonthCheck", 1);
} else if (crawlingIfOlder >= 60*24) { } else if (crawlingIfOlder >= 60*24) {
prop.put("crawlingIfOlderNumber", crawlingIfOlder / 60*24); prop.put("crawlingIfOlderNumber", crawlingIfOlder / (60*24));
prop.put("crawlingIfOlderUnitDayCheck", 1); prop.put("crawlingIfOlderUnitDayCheck", 1);
} else if (crawlingIfOlder >= 60) { } else if (crawlingIfOlder >= 60) {
prop.put("crawlingIfOlderNumber", crawlingIfOlder / 60); prop.put("crawlingIfOlderNumber", crawlingIfOlder / 60);

@ -79,7 +79,7 @@ public final class hello {
int count = 0; int count = 0;
try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (NumberFormatException e) {count = 0;} try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (NumberFormatException e) {count = 0;}
// final Date remoteTime = yacyCore.parseUniversalDate((String) post.get(MYTIME)); // read remote time // final Date remoteTime = yacyCore.parseUniversalDate((String) post.get(MYTIME)); // read remote time
final yacySeed remoteSeed = yacySeed.genRemoteSeed(seed, key); final yacySeed remoteSeed = yacySeed.genRemoteSeed(seed, key, true);
// System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString())); // System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString()));
if (remoteSeed == null) { return null; } if (remoteSeed == null) { return null; }

@ -118,7 +118,7 @@ public final class message {
return prop; return prop;
} }
//Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time //Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time
yacySeed otherSeed = yacySeed.genRemoteSeed(otherSeedString, key); yacySeed otherSeed = yacySeed.genRemoteSeed(otherSeedString, key, true);
String subject = crypt.simpleDecode(post.get("subject", ""), key); // message's subject String subject = crypt.simpleDecode(post.get("subject", ""), key); // message's subject
String message = crypt.simpleDecode(post.get("message", ""), key); // message body String message = crypt.simpleDecode(post.get("message", ""), key); // message body

@ -94,7 +94,7 @@ public final class search {
if (yacyCore.seedDB == null) { if (yacyCore.seedDB == null) {
yacyCore.log.logSevere("yacy.search: seed cache not initialized"); yacyCore.log.logSevere("yacy.search: seed cache not initialized");
} else { } else {
yacyCore.peerActions.peerArrival(yacySeed.genRemoteSeed(oseed, key), true); yacyCore.peerActions.peerArrival(yacySeed.genRemoteSeed(oseed, key, true), true);
} }
// prepare search // prepare search

@ -151,7 +151,7 @@ public final class yacyClient {
yacySeed otherPeer = null; yacySeed otherPeer = null;
float otherPeerVersion = 0; float otherPeerVersion = 0;
if (otherHash != null && otherHash.length() > 0) { if (otherHash != null && otherHash.length() > 0) {
otherPeer = yacySeed.genRemoteSeed((String) result.get("seed0"), key); otherPeer = yacySeed.genRemoteSeed((String) result.get("seed0"), key, true);
if (otherPeer == null || !otherPeer.hash.equals(otherHash)) { if (otherPeer == null || !otherPeer.hash.equals(otherHash)) {
yacyCore.log.logFine("yacyClient.publishMySeed: consistency error: other peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' wrong"); yacyCore.log.logFine("yacyClient.publishMySeed: consistency error: other peer '" + ((otherPeer==null)?"unknown":otherPeer.getName()) + "' wrong");
return -1; // no success return -1; // no success
@ -233,7 +233,7 @@ public final class yacyClient {
while ((seedStr = (String) result.get(yacySeed.SEED + i++)) != null) { while ((seedStr = (String) result.get(yacySeed.SEED + i++)) != null) {
// integrate new seed into own database // integrate new seed into own database
// the first seed, "seed0" is the seed of the responding peer // the first seed, "seed0" is the seed of the responding peer
if (yacyCore.peerActions.peerArrival(yacySeed.genRemoteSeed(seedStr, key), (i == 1))) count++; if (yacyCore.peerActions.peerArrival(yacySeed.genRemoteSeed(seedStr, key, true), (i == 1))) count++;
} }
return count; return count;
} }
@ -266,7 +266,7 @@ public final class yacyClient {
if (result == null || result.size() == 0) { return null; } if (result == null || result.size() == 0) { return null; }
//final Date remoteTime = yacyCore.parseUniversalDate((String) result.get(yacySeed.MYTIME)); // read remote time //final Date remoteTime = yacyCore.parseUniversalDate((String) result.get(yacySeed.MYTIME)); // read remote time
return yacySeed.genRemoteSeed((String) result.get("response"), key); return yacySeed.genRemoteSeed((String) result.get("response"), key, true);
} catch (Exception e) { } catch (Exception e) {
yacyCore.log.logSevere("yacyClient.querySeed error:" + e.getMessage()); yacyCore.log.logSevere("yacyClient.querySeed error:" + e.getMessage());
return null; return null;

@ -192,7 +192,7 @@ public class yacyPeerActions {
enu = seedList.iterator(); enu = seedList.iterator();
lc = 0; lc = 0;
while (enu.hasNext()) { while (enu.hasNext()) {
ys = yacySeed.genRemoteSeed((String) enu.next(), null); ys = yacySeed.genRemoteSeed((String) enu.next(), null, true);
if ((ys != null) && (ys.isProper() == null) && if ((ys != null) && (ys.isProper() == null) &&
((seedDB.mySeed == null) || (seedDB.mySeed.hash != ys.hash))) { ((seedDB.mySeed == null) || (seedDB.mySeed.hash != ys.hash))) {
if (connectPeer(ys, false)) lc++; if (connectPeer(ys, false)) lc++;

@ -597,7 +597,7 @@ public class yacySeed {
return hash; return hash;
} }
public static yacySeed genRemoteSeed(String seedStr, String key) { public static yacySeed genRemoteSeed(String seedStr, String key, boolean properTest) {
// this method is used to convert the external representation of a seed into a seed object // this method is used to convert the external representation of a seed into a seed object
// yacyCore.log.logFinest("genRemoteSeed: seedStr=" + seedStr + " key=" + key); // yacyCore.log.logFinest("genRemoteSeed: seedStr=" + seedStr + " key=" + key);
if (seedStr == null) { return null; } if (seedStr == null) { return null; }
@ -606,9 +606,15 @@ public class yacySeed {
final HashMap dna = serverCodings.string2map(seed); final HashMap dna = serverCodings.string2map(seed);
final String hash = (String) dna.remove("Hash"); final String hash = (String) dna.remove("Hash");
yacySeed resultSeed = new yacySeed(hash, dna); yacySeed resultSeed = new yacySeed(hash, dna);
if (resultSeed.isProper() == null) return resultSeed; if (properTest) {
String testResult = resultSeed.isProper();
if (testResult != null) {
yacyCore.log.logFinest("seed is not proper (" + testResult + "): " + resultSeed);
return null; return null;
} }
}
return resultSeed;
}
public String toString() { public String toString() {
synchronized (this.dna) { synchronized (this.dna) {
@ -655,7 +661,7 @@ public class yacySeed {
final char[] b = new char[(int) f.length()]; final char[] b = new char[(int) f.length()];
fr.read(b, 0, b.length); fr.read(b, 0, b.length);
fr.close(); fr.close();
return genRemoteSeed(new String(b), null); return genRemoteSeed(new String(b), null, false);
} }
public Object clone() { public Object clone() {

Loading…
Cancel
Save