Mercurial > hg > monetdb-java
diff src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java @ 769:b6d113ee35ae
Fixed javac version 20 compiler warnings.
The java.net.URL(String) constructor is deprecated since version 20.
It needs to be replaced by: java.net.URI(String).toURL() and some extra Exception catching.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 06 Jul 2023 18:28:10 +0200 (22 months ago) |
parents | 0a22044eee9c |
children | 2bd1983f1c11 |
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java +++ b/src/main/java/org/monetdb/jdbc/MonetPreparedStatement.java @@ -1887,8 +1887,10 @@ public class MonetPreparedStatement try { // also check if x represents a valid url string to prevent // failing exec #(..., ...) calls which destroy the prepared statement, see bug 6351 - java.net.URL url_obj = new java.net.URL(x); - } catch (java.net.MalformedURLException mue) { + // Note: as of Java version 20 java.net.URL(String) constructor is deprecated. + // https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/net/URL.html#%3Cinit%3E(java.lang.String) + java.net.URL url_obj = new java.net.URI(x).toURL(); + } catch (java.net.URISyntaxException | java.net.MalformedURLException mue) { throw new SQLDataException("Conversion of string: " + x + " to parameter data type " + paramMonetdbType + " failed. " + mue.getMessage(), "22M30"); } castprefix = "url ";