fix for malformed hostpath names in crawl balancer

pull/1/head
orbiter 11 years ago
parent 161a11070c
commit e9163e7e10

@ -91,7 +91,7 @@ public class HostBalancer implements Balancer {
} else {
this.queues.put(DigestURL.hosthash(queue.getHost(), queue.getPort()), queue);
}
} catch (MalformedURLException e) {
} catch (MalformedURLException|RuntimeException e) {
ConcurrentLog.logException(e);
}
this.roundRobinHostHashes = new HashSet<String>();

@ -95,6 +95,7 @@ public class HostQueue implements Balancer {
// parse the hostName and port from the file name
String filename = hostPath.getName();
int p = filename.lastIndexOf('.');
if (p < 0) throw new RuntimeException("hostPath name must contain a dot: " + filename);
this.hostName = filename.substring(0, p);
this.port = Integer.parseInt(filename.substring(p + 1));
init();

Loading…
Cancel
Save