Skip to content

Commit

Permalink
updates pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
robfrank committed Oct 15, 2024
1 parent 3192f89 commit d6d9b1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -16,7 +16,7 @@ repos:
- --list-different
- --ignore-unknown
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
rev: v2.14.0
hooks:
- id: pretty-format-kotlin
args: [--autofix]
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import com.arcadeanalytics.provider.DataSourceInfo;
import com.arcadeanalytics.provider.rdbms.exception.RDBMSProviderRuntimeException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -69,7 +71,8 @@ public static Connection getConnection(DataSourceInfo datasource) {

try {
Map<String, String> connectionAdditionalProperties = new ObjectMapper()
.readValue(Optional.ofNullable(datasource.getConnectionProperties()).orElse("{}"), HashMap.class);
.readValue(Optional.ofNullable(datasource.getConnectionProperties())
.orElse("{}"), HashMap.class);

if (connectionAdditionalProperties.size() > 0) {
for (String connectionProp : connectionAdditionalProperties.keySet()) {
Expand All @@ -86,9 +89,9 @@ public static Connection getConnection(DataSourceInfo datasource) {

public static String createConnectionUrl(DataSourceInfo datasource) {
return type2template
.get(datasource.getType())
.replace("{server}", datasource.getServer())
.replace("{port}", String.valueOf(datasource.getPort()))
.replace("{database}", datasource.getDatabase());
.get(datasource.getType())
.replace("{server}", datasource.getServer())
.replace("{port}", String.valueOf(datasource.getPort()))
.replace("{database}", datasource.getDatabase());
}
}

0 comments on commit d6d9b1c

Please sign in to comment.