@@ -235,16 +235,15 @@ private BigQuerySettings generateBigQuerySettings() {
235235 */
236236 @ Override
237237 public ResultSet executeQuery (String sql ) throws SQLException {
238- checkClosed ();
239238 try (BigQueryJdbcMdc .MdcCloseable mdc =
240239 BigQueryJdbcMdc .registerInstance (this .connection , this .connectionId )) {
241240 LOG .finest ("++enter++" );
241+ checkClosed ();
242242 return executeQueryImpl (sql );
243243 }
244244 }
245245
246246 private ResultSet executeQueryImpl (String sql ) throws SQLException {
247- // TODO: write method to return state variables to original state.
248247 logQueryExecutionStart (sql );
249248 try {
250249 QueryJobConfiguration jobConfiguration =
@@ -264,10 +263,10 @@ private ResultSet executeQueryImpl(String sql) throws SQLException {
264263
265264 @ Override
266265 public long executeLargeUpdate (String sql ) throws SQLException {
267- checkClosed ();
268266 try (BigQueryJdbcMdc .MdcCloseable mdc =
269267 BigQueryJdbcMdc .registerInstance (this .connection , this .connectionId )) {
270268 LOG .finest ("++enter++" );
269+ checkClosed ();
271270 return executeLargeUpdateImpl (sql );
272271 }
273272 }
@@ -311,10 +310,10 @@ int checkUpdateCount(long updateCount) {
311310
312311 @ Override
313312 public boolean execute (String sql ) throws SQLException {
314- checkClosed ();
315313 try (BigQueryJdbcMdc .MdcCloseable mdc =
316314 BigQueryJdbcMdc .registerInstance (this .connection , this .connectionId )) {
317315 LOG .finest ("++enter++" );
316+ checkClosed ();
318317 return executeImpl (sql );
319318 }
320319 }
@@ -1483,10 +1482,10 @@ public boolean hasMoreResults() {
14831482
14841483 @ Override
14851484 public boolean getMoreResults (int current ) throws SQLException {
1486- checkClosed ();
14871485 try (BigQueryJdbcMdc .MdcCloseable mdc =
14881486 BigQueryJdbcMdc .registerInstance (this .connection , this .connectionId )) {
14891487 LOG .finest ("++enter++" );
1488+ checkClosed ();
14901489 return getMoreResultsImpl (current );
14911490 }
14921491 }
@@ -1582,7 +1581,6 @@ protected void logQueryExecutionStart(String sql) {
15821581 /** Throws a {@link BigQueryJdbcException} if this object is closed */
15831582 void checkClosed () throws SQLException {
15841583 if (isClosed ()) {
1585- LOG .severe ("This " + getClass ().getName () + " has been closed" );
15861584 throw new BigQueryJdbcException ("This " + getClass ().getName () + " has been closed" );
15871585 }
15881586 }
0 commit comments