eskabetxe commented on code in PR #116:
URL: 
https://github.com/apache/flink-connector-jdbc/pull/116#discussion_r1584601921


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/AbstractJdbcCatalog.java:
##########
@@ -88,32 +92,49 @@ public abstract class AbstractJdbcCatalog extends 
AbstractCatalog {
     private static final Logger LOG = 
LoggerFactory.getLogger(AbstractJdbcCatalog.class);
 
     protected final ClassLoader userClassLoader;
-    protected final String username;
-    protected final String pwd;
     protected final String baseUrl;
     protected final String defaultUrl;
+    protected final Properties connectionProperties;
 
+    @Deprecated
     public AbstractJdbcCatalog(
             ClassLoader userClassLoader,
             String catalogName,
             String defaultDatabase,
             String username,
             String pwd,
             String baseUrl) {
+        this(
+                userClassLoader,
+                catalogName,
+                defaultDatabase,
+                baseUrl,
+                getBriefAuthProperties(username, pwd));
+    }
+
+    public AbstractJdbcCatalog(
+            ClassLoader userClassLoader,
+            String catalogName,
+            String defaultDatabase,
+            String baseUrl,
+            Properties connectionProperties) {
         super(catalogName, defaultDatabase);
 
         checkNotNull(userClassLoader);
-        checkArgument(!StringUtils.isNullOrWhitespaceOnly(username));
-        checkArgument(!StringUtils.isNullOrWhitespaceOnly(pwd));
         checkArgument(!StringUtils.isNullOrWhitespaceOnly(baseUrl));
 
         JdbcCatalogUtils.validateJdbcUrl(baseUrl);
 
         this.userClassLoader = userClassLoader;
-        this.username = username;
-        this.pwd = pwd;
         this.baseUrl = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
         this.defaultUrl = this.baseUrl + defaultDatabase;
+        this.connectionProperties = 
Preconditions.checkNotNull(connectionProperties);
+        if 
(StringUtils.isNullOrWhitespaceOnly(connectionProperties.getProperty(USER_KEY)))
 {

Review Comment:
   we should maintain the current checks
   ```
   
checkArgument(!StringUtils.isNullOrWhitespaceOnly(connectionProperties.getProperty(USER_KEY)));
   
checkArgument(!StringUtils.isNullOrWhitespaceOnly(connectionProperties.getProperty(PASSWORD_KEY)));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to