Repository navigation
fix: load JDBC driver before DriverManager.getConnection in Setup (#1082) - #1091
HusainMain wants to merge 6 commits into
Conversation
|
Hi HusainMain, Spotless:check fails on the new htmlOutput line in the ClassNotFoundException handler (over 100 characters). Running mvn spotless:apply fixes it, and CI will fail until then. Once that is pushed builds should run smoothly. |
|
Thanks for the review. Applied the formatting and pushed — lint-java should be green now. |
|
Thanks for this. The CI problem is fixed on dev (#1116), and I've closed #1115 because it duplicated this PR. This is the one we're keeping for #1082. Two things before review: Test. Please add a regression test, or add manual steps to the description: delete database.properties, restart Tomcat, run setup, and check there is no "No suitable driver" error. Small fix. If the driver can't be loaded, the failure message is shown twice. Setting htmlOutput in the new catch block and then appending to it again below causes this. Dropping one of them fixes it. I'll approve the CI run if it's waiting. |
Fixes #1082
When Tomcat starts without database.properties, Setup.doPost calls
DriverManager.getConnection() without first loading the JDBC driver class.
Tomcat doesn't auto-register drivers from WEB-INF/lib, so setup fails with
"No suitable driver found".
Added Class.forName(driverType) before DriverManager.getConnection so the
driver is registered before the connection attempt. On ClassNotFoundException,
the error is logged and reported cleanly instead of crashing.
Changes:
Build: