<commit_before>package webdriver.browsers;

import com.atlassian.webdriver.AtlassianWebDriver;
import com.atlassian.webdriver.WebDriverFactory;
import org.openqa.selenium.WebDriver;

import java.io.File;

/**
 * Client that supports automatically installing the appropriate browser for the environment
 *
 */
public enum WebDriverBrowserAutoInstall
{
    INSTANCE;

    private AutoInstallConfiguration config;
    private AtlassianWebDriver driver;

    WebDriverBrowserAutoInstall() {
        this.config = new AutoInstallConfiguration();

        Runtime.getRuntime().addShutdownHook(new Thread()
        {
            @Override
            public void run()
            {
                driver.quit();
            }
        });

        driver = WebDriverFactory.getDriver();

    }

    public AtlassianWebDriver getDriver()
    {
        return driver;
    }
}<commit_msg>When closing the driver instance, suppressed a WebDriverException which could be thrown sometimes by WebDriver's RemoteWebDriver when it tries to close an already closed browser.<commit_after>package webdriver.browsers;

import com.atlassian.webdriver.AtlassianWebDriver;
import com.atlassian.webdriver.WebDriverFactory;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;

import java.io.File;
import java.net.SocketException;

/**
 * Client that supports automatically installing the appropriate browser for the environment
 *
 */
public enum WebDriverBrowserAutoInstall
{
    INSTANCE;

    private AutoInstallConfiguration config;
    private AtlassianWebDriver driver;
    
    WebDriverBrowserAutoInstall() {
        this.config = new AutoInstallConfiguration();

        Runtime.getRuntime().addShutdownHook(new Thread()
        {
            @Override
            public void run()
            {
                try
                {
                    driver.quit();
                } catch (WebDriverException e)
                {
                    // WebDriver's RemoteWebDriver will try to close the browser
                    // when it has already been closed, and as a result throws a
                    // WebDriverException caused by a SocketException. We want
                    // to ignore this exception.
                    if (!(e.getCause() instanceof SocketException))
                    {
                        throw e;
                    }
                }
           }
        });

        driver = WebDriverFactory.getDriver();

    }

    public AtlassianWebDriver getDriver()
    {
        return driver;
    }
}
{'fraction_non_alphanumeric': 0.0705378020265004, 'fraction_numerical': 0.0, 'mean_word_length': 2.1077481840193704, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3234843', 'n_tokens_mistral': 646, 'n_tokens_neox': 606, 'n_words': 167}