diff src/main/java/org/monetdb/jdbc/MonetResultSet.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 3dd0d43014e8
children 2bd1983f1c11
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetResultSet.java
+++ b/src/main/java/org/monetdb/jdbc/MonetResultSet.java
@@ -2463,9 +2463,11 @@ public class MonetResultSet
 			}
 			lastReadWasNull = false;
 			try {
-				return new URL(val);
-			} catch (java.net.MalformedURLException e) {
-				throw new SQLException(e.getMessage(), "M1M05");
+				// 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)
+				return new java.net.URI(val).toURL();
+			} catch (java.net.URISyntaxException | java.net.MalformedURLException e) {
+				throw new SQLException(e.getMessage(), "22M30");
 			}
 		} catch (IndexOutOfBoundsException e) {
 			throw newSQLInvalidColumnIndexException(columnIndex);