}
}
private void spider(SiteNode startNode) throws InterruptedException, MalformedURLException {
logger.info("About to grab spider.");
ExtensionSpider extSpider = (ExtensionSpider) Control.getSingleton().getExtensionLoader().getExtension(ExtensionSpider.NAME);
logger.info("Starting spider.");
if (extSpider == null) {
logger.error("No spider");
extension.notifyProgress(Progress.FAILED);
return;
} else if (startNode == null) {
logger.error("start node was null");
extension.notifyProgress(Progress.FAILED);
return;
} else {
logger.info("Starting spider.");
extension.notifyProgress(Progress.SPIDER);
startNode.setAllowsChildren(true);
for (String node : nodes) {
logger.info("About to call accessNode.");
SiteNode childNode = accessNode(new URL(url + node));
logger.info("got out of accessNode.");
if (childNode != null) {
logger.info("Child node != null, child node is " + childNode);
//childNode.setParent(startNode);
//startNode.add(childNode);
} else {
logger.info("child node was null.");
}
//extSpider.startScanNode(childNode);
}
logger.info("about to start the extension. node = " + startNode);
logger.info("child count = " + startNode.getChildCount());
extSpider.startScanNode(startNode);
logger.info("Started the extension.");
}
// Give some time to the spider to finish to setup and start itself.
sleep(1500);
try {
// Wait for the spider to complete
while (extSpider.isScanning(startNode, true)) {
sleep (500);
if (this.stopAttack) {
extSpider.stopScan(startNode);
break;
}
}
} catch (InterruptedException e) {
// Ignore