<commit_before>package com.datamountaineer.streamreactor.connect.jdbc;

import com.datamountaineer.streamreactor.connect.jdbc.common.ParameterValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Responsible for creating the database connection. It provides automatic retries.
 */
public class ConnectionProvider {
  private final Logger logger = LoggerFactory.getLogger(ConnectionProvider.class);

  private final int retries;
  private final int delayBetweenRetries;
  private final String uri;
  private final String user;
  private final String password;

  public ConnectionProvider(String uri, String user, String password, int retries, int delayBetweenRetries) {
    ParameterValidator.notNullOrEmpty(uri, "uri");
    this.retries = retries;
    this.delayBetweenRetries = delayBetweenRetries;
    this.uri = uri;
    this.user = user;
    this.password = password;
  }

  /**
   * Returns a new instance of jdbc Connection
   *
   * @return
   * @throws SQLException
   */
  public Connection getConnection() throws SQLException {
    Connection connection = null;
    int retriesLeft = retries;
    SQLException exception = null;
    while (retriesLeft > 0 && connection == null) {
      try {
        connection = DriverManager.getConnection(uri, user, password);
      } catch (SQLException e) {
        retriesLeft--;
        if (retriesLeft == 0) {
          exception = e;
        }
        logger.warn(String.format("Trying to open the database failed. Retries left %d", retriesLeft), e);
        try {
          Thread.sleep(delayBetweenRetries);
        } catch (InterruptedException e1) {

        }
      }
    }
    if (exception != null) {
      throw exception;
    }

    return connection;
  }

}<commit_msg>Rethrow InterruptedException as SQLException rather than swallowing it<commit_after>package com.datamountaineer.streamreactor.connect.jdbc;

import com.datamountaineer.streamreactor.connect.jdbc.common.ParameterValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Responsible for creating the database connection. It provides automatic retries.
 */
public class ConnectionProvider {
  private final Logger logger = LoggerFactory.getLogger(ConnectionProvider.class);

  private final int retries;
  private final int delayBetweenRetries;
  private final String uri;
  private final String user;
  private final String password;

  public ConnectionProvider(String uri, String user, String password, int retries, int delayBetweenRetries) {
    ParameterValidator.notNullOrEmpty(uri, "uri");
    this.retries = retries;
    this.delayBetweenRetries = delayBetweenRetries;
    this.uri = uri;
    this.user = user;
    this.password = password;
  }

  public Connection getConnection() throws SQLException {
    Connection connection = null;
    int retriesLeft = retries;
    SQLException exception = null;
    while (retriesLeft > 0 && connection == null) {
      try {
        connection = DriverManager.getConnection(uri, user, password);
      } catch (SQLException e) {
        retriesLeft--;
        if (retriesLeft == 0) {
          exception = e;
        }
        logger.warn(String.format("Trying to open the database failed. Retries left %d", retriesLeft), e);
        try {
          Thread.sleep(delayBetweenRetries);
        } catch (InterruptedException ie) {
          throw new SQLException(ie);
        }
      }
    }
    if (exception != null) {
      throw exception;
    }

    return connection;
  }

}
{'fraction_non_alphanumeric': 0.08806740962217995, 'fraction_numerical': 0.002446316933949443, 'mean_word_length': 3.2740998838559814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4267998', 'n_tokens_mistral': 1031, 'n_tokens_neox': 1001, 'n_words': 282}