mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-03 15:08:12 +01: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();
|
Enumeration<Driver> drivers = DriverManager.getDrivers();
|
||||||
while (drivers.hasMoreElements()) {
|
while (drivers.hasMoreElements()) {
|
||||||
Driver driver = drivers.nextElement();
|
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 {
|
try {
|
||||||
DriverManager.deregisterDriver(driver);
|
DriverManager.deregisterDriver(driver);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user