implemented brute force counter measure

This commit is contained in:
2025-08-27 19:09:56 +02:00
parent 55340bc929
commit e1f32c274b
8 changed files with 111 additions and 62 deletions

View File

@@ -1,6 +1,8 @@
/* © SRSoftware 2025 */
package de.srsoftware.umbrella.core;
import static java.lang.System.Logger.Level.INFO;
import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
@@ -8,7 +10,7 @@ import java.util.HashMap;
import org.sqlite.SQLiteDataSource;
public class ConnectionProvider {
private static final System.Logger LOG = System.getLogger(ConnectionProvider.class.getSimpleName());
private static final HashMap<File, Connection> connections = new HashMap<>();
private ConnectionProvider(){}
@@ -17,7 +19,10 @@ public class ConnectionProvider {
if (o instanceof String filename) o = new File(filename);
if (o instanceof File dbFile) try {
var conn = connections.get(dbFile);
if (conn == null) connections.put(dbFile, conn = open(dbFile));
if (conn == null) {
connections.put(dbFile, conn = open(dbFile));
LOG.log(INFO,"Using {0}",dbFile);
}
return conn;
} catch (SQLException sqle) {
throw new RuntimeException(sqle);