Skip to content

Commit 0fcc8cf

Browse files
committed
six log messages
1 parent c8abf41 commit 0fcc8cf

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,7 @@ private void checkClosed() {
947947

948948
private void checkIfEnabledSession(String methodName) {
949949
if (!this.enableSession) {
950+
LOG.severe("Session needs to be enabled to use %s method.", methodName);
950951
throw new IllegalStateException(
951952
String.format("Session needs to be enabled to use %s method.", methodName));
952953
}

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryStatement.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)