Apache Nutch is an extensible and scalable web crawler
NUTCH-2111 Delete temporary files location for selenium tmp files after driver quits
Lewis John McGibbneyd385fe6c8640
diff --git a/CHANGES.txt b/CHANGES.txtindex 86b39849e..e866c6a5f 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -2,6 +2,8 @@ Nutch Change LogNutch Current Development 1.11-SNAPSHOT+* NUTCH-2111 Delete temporary files location for selenium tmp files after driver quits (Kim Whitehall via lewismc)+* NUTCH-2095 WARC exporter for the CommonCrawlDataDumper (jorgelbg)* NUTCH-2102 WARC Exporter (jnioche)diff --git a/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java b/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.javaindex 8cd670186..20d0b2317 100644--- a/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java+++ b/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java@@ -33,6 +33,7 @@ import org.openqa.selenium.remote.DesiredCapabilities;import org.openqa.selenium.remote.RemoteWebDriver;import org.openqa.selenium.safari.SafariDriver;import org.openqa.selenium.support.ui.WebDriverWait;+import org.openqa.selenium.io.TemporaryFilesystem;import com.opera.core.systems.OperaDriver;@@ -96,6 +97,7 @@ public class HttpWebClient {capabilities.setBrowserName("firefox");capabilities.setJavascriptEnabled(true);capabilities.setCapability("firefox_binary",seleniumGridBinary);+ System.setProperty("webdriver.reap_profile", "false");driver = new RemoteWebDriver(new URL(seleniumHubProtocol, seleniumHubHost, seleniumHubPort, seleniumHubPath), capabilities);break;default:@@ -131,6 +133,7 @@ public class HttpWebClient {if (driver != null) {try {driver.quit();+ TemporaryFilesystem.getDefaultTmpFS().deleteTemporaryFiles();} catch (Exception e) {throw new RuntimeException(e);}@@ -161,6 +164,7 @@ public class HttpWebClient {// I'm sure this catch statement is a code smell ; borrowing it from lib-htmlunit} catch (Exception e) {+ TemporaryFilesystem.getDefaultTmpFS().deleteTemporaryFiles();throw new RuntimeException(e);} finally {cleanUpDriver(driver);