You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2025/05/20 14:40:29 UTC

Re: [PR] bugfix: the drivers in the lib folder cannot be loaded [incubator-seata]

Copilot commented on code in PR #7354:
URL: https://github.com/apache/incubator-seata/pull/7354#discussion_r2098160942


##########
core/src/main/java/org/apache/seata/core/store/db/AbstractDataSourceProvider.java:
##########
@@ -106,14 +104,21 @@ public void validate() {
                     .map(file -> file.isFile() ? file.getParentFile() : file)
                     .filter(Objects::nonNull)
                     .filter(File::isDirectory)
-                    .map(file -> new File(file, "jdbc"))
+                    // Only the MySQL driver needs to be placed in the jdbc folder.
+                    .map(file -> (driverClassName.equals(MYSQL8_DRIVER_CLASS_NAME)
+                                    || driverClassName.equals(MYSQL_DRIVER_CLASS_NAME))
+                            ? new File(file, "jdbc")
+                            : file)
                     .filter(File::exists)
                     .filter(File::isDirectory)
-                    .distinct().findAny().orElseThrow(() -> new ShouldNeverHappenException("can not find jdbc folder")).getAbsolutePath();
+                    .distinct()
+                    .findAny()
+                    .map(File::getAbsolutePath)
+                    .orElseThrow(() -> new ShouldNeverHappenException("can not find jdbc folder"));

Review Comment:
   [nitpick] The exception message uses "can not"; consider using the single-word form "cannot" for consistency and clarity.
   ```suggestion
                       .orElseThrow(() -> new ShouldNeverHappenException("cannot find jdbc folder"));
   ```



-- 
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: notifications-unsubscribe@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org