diff src/main/java/org/monetdb/jdbc/MonetConnection.java @ 692:2233b172e06d

Add checks for sql String parameter to prevent NullPointerException or executing an empty sql String.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 17 Nov 2022 19:16:48 +0100 (2022-11-17)
parents f7946d36d1dd
children 07d60185eeb9
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/org/monetdb/jdbc/MonetConnection.java
@@ -770,6 +770,10 @@ public class MonetConnection
 		throws SQLException
 	{
 		checkNotClosed();
+
+		if (sql == null || sql.isEmpty())
+			throw new SQLException("Missing SQL statement", "M1M05");
+
 		try {
 			final CallableStatement ret = new MonetCallableStatement(
 				this,
@@ -875,6 +879,10 @@ public class MonetConnection
 		throws SQLException
 	{
 		checkNotClosed();
+
+		if (sql == null || sql.isEmpty())
+			throw new SQLException("Missing SQL statement", "M1M05");
+
 		try {
 			final PreparedStatement ret = new MonetPreparedStatement(
 				this,