From 9658a8e6ae72e5c7002917f225aad9b8e60641f8 Mon Sep 17 00:00:00 2001 From: PseudoKnight Date: Thu, 1 Aug 2024 00:10:08 -0700 Subject: [PATCH] Fix DataSource cache when using modifiers --- .../java/com/laytonsmith/persistence/DataSourceFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/laytonsmith/persistence/DataSourceFactory.java b/src/main/java/com/laytonsmith/persistence/DataSourceFactory.java index 72887b1c8f..d3636e2c48 100644 --- a/src/main/java/com/laytonsmith/persistence/DataSourceFactory.java +++ b/src/main/java/com/laytonsmith/persistence/DataSourceFactory.java @@ -53,7 +53,8 @@ private static void init() { public static DataSource GetDataSource(URI uri, ConnectionMixinFactory.ConnectionMixinOptions options) throws DataSourceException { init(); - DataSource source = DATA_SOURCE_POOL.get(uri); + URI uriKey = uri; + DataSource source = DATA_SOURCE_POOL.get(uriKey); if(source != null) { return source; } @@ -91,7 +92,7 @@ public static DataSource GetDataSource(URI uri, ConnectionMixinFactory.Connectio if(!ds.getModifiers().contains(DataSource.DataSourceModifier.TRANSIENT)) { ds.populate(); } - DATA_SOURCE_POOL.put(uri, ds); + DATA_SOURCE_POOL.put(uriKey, ds); return ds; } catch (InvocationTargetException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | DataSourceException ex) {