From 7860d5d632a21130498449872dd8ac757a30792a Mon Sep 17 00:00:00 2001 From: orbiter Date: Sun, 12 Oct 2008 19:51:53 +0000 Subject: [PATCH] fix for bug in seed list management (cause was bad class overloading, only visual effects!) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5265 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Network.java | 2 +- source/de/anomic/kelondro/kelondroBLOBHeap.java | 5 +++-- source/de/anomic/kelondro/kelondroMap.java | 8 ++++---- source/de/anomic/kelondro/kelondroMapDataMining.java | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htroot/Network.java b/htroot/Network.java index a9a47fbff..dc9fc74e8 100644 --- a/htroot/Network.java +++ b/htroot/Network.java @@ -308,7 +308,7 @@ public class Network { prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0); prop.put(STR_TABLE_LIST + conCount + "_isCrawling", 0); if (conCount >= maxCount) { break; } - if (sb.webIndex.seedDB.mySeed() != null && seed.hash.equals(sb.webIndex.seedDB.mySeed().hash)) { + if (sb.webIndex.seedDB != null && sb.webIndex.seedDB.mySeed() != null && seed.hash.equals(sb.webIndex.seedDB.mySeed().hash)) { prop.put(STR_TABLE_LIST + conCount + "_dark", 2); } else { prop.put(STR_TABLE_LIST + conCount + "_dark", ((dark) ? 1 : 0) ); dark=!dark; diff --git a/source/de/anomic/kelondro/kelondroBLOBHeap.java b/source/de/anomic/kelondro/kelondroBLOBHeap.java index 9afd01236..3d7a91e02 100755 --- a/source/de/anomic/kelondro/kelondroBLOBHeap.java +++ b/source/de/anomic/kelondro/kelondroBLOBHeap.java @@ -184,7 +184,7 @@ public final class kelondroBLOBHeap implements kelondroBLOB { * the number of BLOBs in the heap * @return the number of BLOBs in the heap */ - public int size() { + public synchronized int size() { return this.index.size(); } @@ -193,7 +193,7 @@ public final class kelondroBLOBHeap implements kelondroBLOB { * @param key * @return true if the key exists, false othervise */ - public boolean has(final byte[] key) { + public synchronized boolean has(final byte[] key) { assert index != null; assert index.row().primaryKeyLength == key.length; @@ -470,6 +470,7 @@ public final class kelondroBLOBHeap implements kelondroBLOB { } heap.remove("aaaaaaaaaaab".getBytes()); heap.remove("aaaaaaaaaaac".getBytes()); + heap.put("aaaaaaaaaaaX".getBytes(), "WXYZ".getBytes()); heap.close(); } catch (final IOException e) { e.printStackTrace(); diff --git a/source/de/anomic/kelondro/kelondroMap.java b/source/de/anomic/kelondro/kelondroMap.java index 6c1900b50..24744f099 100644 --- a/source/de/anomic/kelondro/kelondroMap.java +++ b/source/de/anomic/kelondro/kelondroMap.java @@ -1,4 +1,4 @@ -// kelondroObjects.java +// kelondroMap.java // ----------------------- // (C) 29.01.2007 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany // first published 2004 as kelondroMap on http://www.anomic.de @@ -87,9 +87,9 @@ public class kelondroMap { return bb.toString(); } - private static HashMap string2map(final String s) throws IOException { + private static Map string2map(final String s) throws IOException { final BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(s.getBytes()))); - final HashMap map = new HashMap(); + final Map map = new HashMap(); String line; int pos; while ((line = br.readLine()) != null) { // very slow readLine???? @@ -317,7 +317,7 @@ public class kelondroMap { // make map kelondroMap map = new kelondroMap(blob, 1024); // put some values into the map - HashMap m = new HashMap(); + Map m = new HashMap(); m.put("k", "000"); map.put("123", m); m.put("k", "111"); map.put("456", m); m.put("k", "222"); map.put("789", m); diff --git a/source/de/anomic/kelondro/kelondroMapDataMining.java b/source/de/anomic/kelondro/kelondroMapDataMining.java index 410212baf..bb51f554d 100644 --- a/source/de/anomic/kelondro/kelondroMapDataMining.java +++ b/source/de/anomic/kelondro/kelondroMapDataMining.java @@ -1,4 +1,4 @@ -// kelondroMapObjects.java +// kelondroMapDataMining.java // ----------------------- // (C) 29.01.2007 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany // first published 2004 as part of kelondroMap on http://www.anomic.de @@ -164,7 +164,7 @@ public class kelondroMapDataMining extends kelondroMap { } } - public synchronized void put(final String key, final HashMap newMap) throws IOException { + public synchronized void put(final String key, final Map newMap) throws IOException { assert (key != null); assert (key.length() > 0); assert (newMap != null);