From d8bed3b0df18fdb573b76f777b43e80a900897ca Mon Sep 17 00:00:00 2001 From: Phillip Ross Date: Thu, 7 Dec 2023 17:08:47 -0500 Subject: [PATCH] - FIX: connect() method modification to retain "mangled" url for connection - FIX: acceptsURL() method rework to avoid potentially invoking super method with null param Signed-off-by: Phillip Ross --- .../main/java/net/postgis/jdbc/DriverWrapper.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/postgis-jdbc/src/main/java/net/postgis/jdbc/DriverWrapper.java b/postgis-jdbc/src/main/java/net/postgis/jdbc/DriverWrapper.java index 1324416..615d049 100644 --- a/postgis-jdbc/src/main/java/net/postgis/jdbc/DriverWrapper.java +++ b/postgis-jdbc/src/main/java/net/postgis/jdbc/DriverWrapper.java @@ -154,7 +154,9 @@ private static TypesAdder loadTypesAdder(final String version) throws SQLExcepti * @see org.postgresql.Driver */ public java.sql.Connection connect(String url, final Properties info) throws SQLException { - if (!acceptsURL(url)) { + if (acceptsURL(url)) { + url = mangleURL(url); + } else { return null; } Connection result = super.connect(url, info); @@ -186,8 +188,12 @@ protected boolean useLW(final Connection result) { * @return true if this driver accepts the given URL */ public boolean acceptsURL(String url) { - url = mangleURL(url); - return url != null && super.acceptsURL(url); + String mangledURL = mangleURL(url); + if (mangledURL == null) { + return false; + } else { + return super.acceptsURL(mangledURL); + } }