From 3701cc2511dae3e79ca5981f365e9b94b46735cc Mon Sep 17 00:00:00 2001 From: Vighnesh Kadam <50268642+vighnesh-kadam@users.noreply.github.com> Date: Wed, 11 May 2022 16:01:08 +0530 Subject: [PATCH] refactor: check if null in PreparedStatement (#1795) --- .../com/_4paradigm/openmldb/jdbc/PreparedStatement.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/java/openmldb-jdbc/src/main/java/com/_4paradigm/openmldb/jdbc/PreparedStatement.java b/java/openmldb-jdbc/src/main/java/com/_4paradigm/openmldb/jdbc/PreparedStatement.java index cb6f54dccb0..f9d5dc7cdd5 100644 --- a/java/openmldb-jdbc/src/main/java/com/_4paradigm/openmldb/jdbc/PreparedStatement.java +++ b/java/openmldb-jdbc/src/main/java/com/_4paradigm/openmldb/jdbc/PreparedStatement.java @@ -272,13 +272,12 @@ protected void dataBuild() throws SQLException { columnTypes.AddColumnType(types.get(i + 1)); } this.currentRow = SQLRequestRow.CreateSQLRequestRowFromColumnTypes(columnTypes); - // TODO(hw): check if null + if (this.currentRow == null) { + throw new SQLException("fail to create sql request row from column types"); + } this.currentSchema = this.currentRow.GetSchema(); this.orgTypes = this.types; } - if (this.currentRow == null) { - throw new SQLException("fail to build data with null row"); - } if (this.currentSchema == null) { throw new SQLException("fail to build data with null schema"); }