<commit_before>package org.seleniumhq.selenium.fluent;

import org.seleniumhq.selenium.fluent.recording.RetryStrategy;

public class RetryingFluentWebDriverExecutor implements FluentWebDriverExecutor {
    private final int millisToSleep;
    private final RetryStrategy[] retryStrategies;

    public RetryingFluentWebDriverExecutor(int millisToSleep, RetryStrategy... retryStrategies) {
        this.millisToSleep = millisToSleep;
        this.retryStrategies = retryStrategies;
    }
    
    public Object playback(FluentWebDriver driver, FluentWebDriverExecution execution) {
        long start = System.currentTimeMillis();
        int retries = 0;
        RuntimeException lastRE = null;
        AssertionError lastAE = null;
        boolean goAgain = true;
        while (goAgain) {
            lastAE = null;
            lastRE = null;
            goAgain = false;
            try {
                return execution.execute(driver);
            } catch (FluentExecutionStopped e) {
                lastRE = e;
                goAgain = retry(e, start, retries);
            } catch (RuntimeException e) {
                lastRE = e;
                goAgain = retry(e, start, retries);
            } catch (AssertionError e) {
                lastAE = e;
                goAgain = retry(e, start, retries);
            }
            if (goAgain) {
                try {
                    Thread.sleep(millisToSleep);
                } catch (InterruptedException e) {
                }
                retries++;
            }
        }
        if (lastRE != null) {
            if (lastRE instanceof FluentExecutionStopped && retries > 0) {
                ((FluentExecutionStopped) lastRE).setRetries(retries).setDuration(System.currentTimeMillis() - start);
            }
            throw lastRE;
        } else {
            throw lastAE;
        }
        
        
    }

    private boolean retry(Throwable e, long start, int retries) {
        boolean shouldRetry = retryStrategies.length > 0;
        for (RetryStrategy retryStrategy : retryStrategies) {
            shouldRetry = shouldRetry & retryStrategy.shouldRetry(e, start, retries);
        }
        return shouldRetry;
    }


}<commit_msg>whitespace<commit_after>package org.seleniumhq.selenium.fluent;

import org.seleniumhq.selenium.fluent.recording.RetryStrategy;

public class RetryingFluentWebDriverExecutor implements FluentWebDriverExecutor {
    private final int millisToSleep;
    private final RetryStrategy[] retryStrategies;

    public RetryingFluentWebDriverExecutor(int millisToSleep, RetryStrategy... retryStrategies) {
        this.millisToSleep = millisToSleep;
        this.retryStrategies = retryStrategies;
    }
    
    public Object playback(FluentWebDriver driver, FluentWebDriverExecution execution) {
        long start = System.currentTimeMillis();
        int retries = 0;
        RuntimeException lastRE = null;
        AssertionError lastAE = null;
        boolean goAgain = true;
        while (goAgain) {
            lastAE = null;
            lastRE = null;
            goAgain = false;
            try {
                return execution.execute(driver);
            } catch (FluentExecutionStopped e) {
                lastRE = e;
                goAgain = retry(e, start, retries);
            } catch (RuntimeException e) {
                lastRE = e;
                goAgain = retry(e, start, retries);
            } catch (AssertionError e) {
                lastAE = e;
                goAgain = retry(e, start, retries);
            }
            if (goAgain) {
                try {
                    Thread.sleep(millisToSleep);
                } catch (InterruptedException e) {
                }
                retries++;
            }
        }
        if (lastRE != null) {
            if (lastRE instanceof FluentExecutionStopped && retries > 0) {
                ((FluentExecutionStopped) lastRE).setRetries(retries).setDuration(System.currentTimeMillis() - start);
            }
            throw lastRE;
        } else {
            throw lastAE;
        }
    }

    private boolean retry(Throwable e, long start, int retries) {
        boolean shouldRetry = retryStrategies.length > 0;
        for (RetryStrategy retryStrategy : retryStrategies) {
            shouldRetry = shouldRetry & retryStrategy.shouldRetry(e, start, retries);
        }
        return shouldRetry;
    }
}
{'fraction_non_alphanumeric': 0.07969209870953135, 'fraction_numerical': 0.0013583880461851936, 'mean_word_length': 1.8230031948881789, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3144236', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1172, 'n_words': 266}