You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "jackyyyyyssss (via GitHub)" <gi...@apache.org> on 2023/07/20 02:39:53 UTC

[GitHub] [seatunnel] jackyyyyyssss commented on a diff in pull request #5097: [Improve][Connector-v2][Jdbc] check url not null throw friendly message

jackyyyyyssss commented on code in PR #5097:
URL: https://github.com/apache/seatunnel/pull/5097#discussion_r1268868352


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectLoader.java:
##########
@@ -46,6 +48,8 @@ private JdbcDialectLoader() {}
      * @return The loaded dialect.
      */
     public static JdbcDialect load(String url, String compatibleMode) {
+        Preconditions.checkNotNull(
+                url, "Miss <Source> Jdbc config url ! Please check the config file.");

Review Comment:
   There are three reasons for this
   1.if the URL is empty, the following code will throw a null pointer exception. Running the following code is meaningless
   2. Check in advance that the URL provides a customized exception message that is clearer than the original error prompt. The original code runs to the final List<JdbcDialectFactory>matchingFactories=
   FoundFactories. stream(). filter (f ->f. acceptsURL (URL)). collect (Collectors. toList()); Will throw a null pointer exception and display the information of DB2, causing confusion for users  issues  #5094 
   3. This is about the entry method for loading the JdbcDialect dialect. Personally, I feel that the starting check parameter of the method is more suitable
   
    
   
   
   



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org