fix for HTCache organisation that may have caused unlimited grow of the cache

appeared only for tree-caches

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4433 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 96c5e6acc7
commit a5d388bfff

@ -809,11 +809,13 @@ public final class plasmaHTCache {
/** /**
* This is a helper funktion that extracts the Hash from the filename * This is a helper function that extracts the Hash from the filename
*/ */
public static String getHash(final File f) { public static String getHash(final File f) {
if ((!f.isFile()) || (f.getPath().indexOf("hash") < 0)) return null; if ((!f.isFile()) || (f.getPath().indexOf("hash") < 0)) return null;
String hexHash = f.getName().substring(0,18); String name = f.getName();
if (name.length() < 18) return null; // not a hash file name
String hexHash = name.substring(0,18);
if (hexHash.indexOf('.') >= 0) return null; if (hexHash.indexOf('.') >= 0) return null;
try { try {
String hash = kelondroBase64Order.enhancedCoder.encode(serverCodings.decodeHex(hexHash)); String hash = kelondroBase64Order.enhancedCoder.encode(serverCodings.decodeHex(hexHash));

Loading…
Cancel
Save