Restore functionality of deprecated SQLite connection acquisition

If the connection is closed, no new SQLite connection is created in plugins still using the
deprecated method.


Introduced in 0ae9c6fcdb
This commit is contained in:
Christian Koop 2022-12-26 13:39:51 +01:00
parent c3fb050444
commit 296f82f50e
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

View File

@ -42,16 +42,8 @@ public class SQLiteConnector implements DatabaseConnector {
@Deprecated @Deprecated
@Override @Override
public void connect(ConnectionCallback callback) { public void connect(ConnectionCallback callback) {
if (this.connection == null) {
try {
this.connection = DriverManager.getConnection(this.connectionString);
} catch (SQLException ex) {
this.plugin.getLogger().severe("An error occurred retrieving the SQLite database connection: " + ex.getMessage());
}
}
try { try {
callback.accept(this.connection); callback.accept(getConnection());
} catch (Exception ex) { } catch (Exception ex) {
this.plugin.getLogger().severe("An error occurred executing an SQLite query: " + ex.getMessage()); this.plugin.getLogger().severe("An error occurred executing an SQLite query: " + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();