fix for ConcurrentModificationException

see http://www.yacy-forum.de/viewtopic.php?p=36566#36566

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3800 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent 4fca11f95d
commit 4ca797401e

@ -29,6 +29,7 @@ package de.anomic.plasma;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ConcurrentModificationException;
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -222,12 +223,19 @@ public class plasmaWebStructure {
public String resolveDomHash2DomString(String domhash) { public String resolveDomHash2DomString(String domhash) {
// returns the domain as string, null if unknown // returns the domain as string, null if unknown
assert domhash.length() == 6; assert domhash.length() == 6;
SortedMap tailMap = structure.tailMap(domhash); try {
if ((tailMap == null) || (tailMap.size() == 0)) return null; SortedMap tailMap = structure.tailMap(domhash);
String key = (String) tailMap.firstKey(); if ((tailMap == null) || (tailMap.size() == 0)) return null;
if (key.startsWith(domhash)) { String key = (String) tailMap.firstKey();
return key.substring(7); if (key.startsWith(domhash)) {
} else { return key.substring(7);
} else {
return null;
}
} catch (ConcurrentModificationException e) {
// we dont want to implement a synchronization here,
// because this is 'only' used for a graphics application
// just return null
return null; return null;
} }
} }

Loading…
Cancel
Save