From edb4b8adc2447bc04e05b9b908195a4bc7926242 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Fri, 19 May 2023 18:37:29 +0800 Subject: [PATCH] fix: use random UUID for external resources --- src/main/java/org/sqlite/SQLiteConnection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/sqlite/SQLiteConnection.java b/src/main/java/org/sqlite/SQLiteConnection.java index 75b67f2dd..5eecdbfb4 100644 --- a/src/main/java/org/sqlite/SQLiteConnection.java +++ b/src/main/java/org/sqlite/SQLiteConnection.java @@ -14,6 +14,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Properties; +import java.util.UUID; import java.util.concurrent.Executor; import org.sqlite.SQLiteConfig.TransactionMode; import org.sqlite.core.CoreDatabaseMetaData; @@ -304,7 +305,7 @@ private static File extractResource(URL resourceAddr) throws IOException { } String tempFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath(); - String dbFileName = String.format("sqlite-jdbc-tmp-%d.db", resourceAddr.hashCode()); + String dbFileName = String.format("sqlite-jdbc-tmp-%s.db", UUID.randomUUID()); File dbFile = new File(tempFolder, dbFileName); if (dbFile.exists()) {