Source:
<code>public H2EmbeddedDataSource(H2EmbeddedDataSourceConfig config) throws Exception { super(config.getMaxConnections(), config.getMaxConnectionWait()); Preconditions.checkNotNull(config.getFilename()); if (config.getFilename().isEmpty()) { throw new IllegalArgumentException("filename is empty"); } StringBuilder jdbcUrlBuilder = new StringBuilder() .append("jdbc:h2:").append(config.getFilename()) .append(";MVCC=").append(config.isMvccEnabled()); if (config.getCipher() != Cipher.NONE) { jdbcUrlBuilder.append(";CIPHER=").append(config.getCipher()); } String jdbcUrl = jdbcUrlBuilder.toString(); dataSource = new JdbcDataSource(); dataSource.setURL(jdbcUrl); dataSource.setUser("sa"); if (config.getCipher() != Cipher.NONE) { dataSource.setPassword(config.getFilePassword() + " "); } else { dataSource.setPassword(""); } <START> dataSource.setLoginTimeout((int) ceil(config.getMaxConnectionWait().getValue(SECONDS))); <END> Connection connection = getConnection(); try { setConfig(connection, "CACHE_SIZE", config.getCacheSize()); setConfig(connection, "COMPRESS_LOB", config.getCompressLob()); setConfig(connection, "MAX_MEMORY_ROWS", config.getMaxMemoryRows()); setConfig(connection, "MAX_LENGTH_INPLACE_LOB", config.getMaxLengthInplaceLob()); setConfig(connection, "DB_CLOSE_DELAY ", "-1"); String fileName = config.getInitScript(); if (fileName != null) { File file = new File(fileName); URL url; if (file.exists()) { url = file.toURI().toURL(); } else { url = getClass().getClassLoader().getResource(fileName); } if (url == null) { throw new FileNotFoundException(fileName); } try (Reader reader = Resources.newReaderSupplier(url, Charsets.UTF_8).getInput()) { ScriptReader scriptReader = new ScriptReader(reader); for (String statement = scriptReader.readStatement(); statement != null; statement = scriptReader.readStatement()) { executeCommand(connection, statement); } } } setConfig(connection, "ALLOW_LITERALS", config.getAllowLiterals()); } finally { closeQuietly(connection); } }</code><technical_language>Ints.checkedCast(config.getMaxConnectionWait().getValue(SECONDS))</technical_language>

Target:
public H2EmbeddedDataSource(H2EmbeddedDataSourceConfig config) throws Exception { super(config.getMaxConnections(), config.getMaxConnectionWait()); Preconditions.checkNotNull(config.getFilename()); if (config.getFilename().isEmpty()) { throw new IllegalArgumentException("filename is empty"); } StringBuilder jdbcUrlBuilder = new StringBuilder() .append("jdbc:h2:").append(config.getFilename()) .append(";MVCC=").append(config.isMvccEnabled()); if (config.getCipher() != Cipher.NONE) { jdbcUrlBuilder.append(";CIPHER=").append(config.getCipher()); } String jdbcUrl = jdbcUrlBuilder.toString(); dataSource = new JdbcDataSource(); dataSource.setURL(jdbcUrl); dataSource.setUser("sa"); if (config.getCipher() != Cipher.NONE) { dataSource.setPassword(config.getFilePassword() + " "); } else { dataSource.setPassword(""); } dataSource.setLoginTimeout(Ints.checkedCast(config.getMaxConnectionWait().roundTo(SECONDS))); Connection connection = getConnection(); try { setConfig(connection, "CACHE_SIZE", config.getCacheSize()); setConfig(connection, "COMPRESS_LOB", config.getCompressLob()); setConfig(connection, "MAX_MEMORY_ROWS", config.getMaxMemoryRows()); setConfig(connection, "MAX_LENGTH_INPLACE_LOB", config.getMaxLengthInplaceLob()); setConfig(connection, "DB_CLOSE_DELAY ", "-1"); String fileName = config.getInitScript(); if (fileName != null) { File file = new File(fileName); URL url; if (file.exists()) { url = file.toURI().toURL(); } else { url = getClass().getClassLoader().getResource(fileName); } if (url == null) { throw new FileNotFoundException(fileName); } try (Reader reader = Resources.newReaderSupplier(url, Charsets.UTF_8).getInput()) { ScriptReader scriptReader = new ScriptReader(reader); for (String statement = scriptReader.readStatement(); statement != null; statement = scriptReader.readStatement()) { executeCommand(connection, statement); } } } setConfig(connection, "ALLOW_LITERALS", config.getAllowLiterals()); } finally { closeQuietly(connection); } }