mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Fix GH-2147 by adding an extra check to make sure we don't remove the wrong driver from the DriverManager (#2148)
Fixes #2147
This commit is contained in:
parent
fe0adf55ca
commit
b680bc099a
@ -153,7 +153,9 @@ public class MySQLDB extends SQLDB {
|
||||
Enumeration<Driver> drivers = DriverManager.getDrivers();
|
||||
while (drivers.hasMoreElements()) {
|
||||
Driver driver = drivers.nextElement();
|
||||
if ("com.mysql.cj.jdbc.Driver".equals(driver.getClass().getName())) {
|
||||
Class<?> driverClass = driver.getClass();
|
||||
// Checks that it's from our class loader to avoid unloading another plugin's/the server's driver
|
||||
if ("com.mysql.cj.jdbc.Driver".equals(driverClass.getName()) && driverClass.getClassLoader() == driverClassLoader) {
|
||||
try {
|
||||
DriverManager.deregisterDriver(driver);
|
||||
} catch (SQLException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user