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


##########
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 -> 
(MYSQL8_DRIVER_CLASS_NAME.equals(driverClassName)
+                                    || 
MYSQL_DRIVER_CLASS_NAME.equals(driverClassName))
+                            ? new File(file, "jdbc")
+                            : file)

Review Comment:
   [nitpick] The inline lambda combining file mapping logic for MySQL and 
non-MySQL drivers is fairly complex; consider extracting it into a named helper 
method to improve readability and maintainability.
   ```suggestion
                       .map(file -> mapFileBasedOnDriver(file, driverClassName))
   ```



##########
changes/zh-cn/2.4.0.md:
##########
@@ -47,6 +48,7 @@ Apache Seata(incubating) 是一款开源的分布式事务解决方案,提供
 - [[#7241](https://github.com/apache/incubator-seata/pull/7241)] 升级 
tomcat-embed-core 至 9.0.99 版本以解决 CVE-2025-24813 
 - [[#7272](https://github.com/apache/incubator-seata/pull/7272)] 修复全局事务显示问题
 - [[#7277](https://github.com/apache/incubator-seata/pull/7277)] 修复MySQL 
jdbc驱动无法正常找到的问题
+- [[#7355](https://github.com/apache/incubator-seata/pull/7355)] 
修复driver无法加载的问题

Review Comment:
   [nitpick] The term “driver” is in English; for consistency in the Chinese 
changelog, consider replacing it with “驱动”.
   ```suggestion
   - [[#7355](https://github.com/apache/incubator-seata/pull/7355)] 修复驱动无法加载的问题
   ```



##########
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 -> 
(MYSQL8_DRIVER_CLASS_NAME.equals(driverClassName)

Review Comment:
   Add or update the Javadoc on `validate()` to explain that only MySQL drivers 
are expected in a `jdbc` subfolder while other drivers are loaded from the 
parent directory.



##########
changes/en-us/2.4.0.md:
##########
@@ -48,6 +49,7 @@ The version is updated as follows:
 - [[#7241](https://github.com/apache/incubator-seata/pull/7241)] upgrade 
tomcat-embed-core to 9.0.99 to fix CVE-2025-24813
 - [[#7272](https://github.com/apache/incubator-seata/pull/7272)] fix: fix 
transaction info not display
 - [[#7277](https://github.com/apache/incubator-seata/pull/7277)] Fix MySQL 
jdbc driver can't be found properly
+- [[#7355](https://github.com/apache/incubator-seata/pull/7355)] the drivers 
in the lib folder cannot be loaded

Review Comment:
   [nitpick] Changelog entries typically start with a verb or keyword (e.g., 
“fix:”); consider rewriting this as “fix: drivers in the lib folder cannot be 
loaded” for consistency.
   ```suggestion
   - [[#7355](https://github.com/apache/incubator-seata/pull/7355)] fix: the 
drivers in the lib folder cannot be loaded
   ```



-- 
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-unsubscr...@seata.apache.org

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


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

Reply via email to