Skip to content

Commit

Permalink
- FIX: connect() method modification to retain "mangled" url for conn…
Browse files Browse the repository at this point in the history
…ection

- FIX: acceptsURL() method rework to avoid potentially invoking super method with null param

Signed-off-by: Phillip Ross <[email protected]>
  • Loading branch information
phillipross committed Dec 7, 2023
1 parent 19a1c46 commit d8bed3b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions postgis-jdbc/src/main/java/net/postgis/jdbc/DriverWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}


Expand Down

0 comments on commit d8bed3b

Please sign in to comment.