Skip to content

Commit 3a4067d

Browse files
committed
fix stragglers
1 parent dbdb887 commit 3a4067d

4 files changed

Lines changed: 16 additions & 52 deletions

File tree

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

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,7 @@ public Statement createStatement(int resultSetType, int resultSetConcurrency)
359359
checkClosed();
360360
if (resultSetType != ResultSet.TYPE_FORWARD_ONLY
361361
|| resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) {
362-
BigQueryJdbcSqlFeatureNotSupportedException ex =
363-
new BigQueryJdbcSqlFeatureNotSupportedException("Unsupported createStatement feature.");
364-
LOG.severe(ex, ex.getMessage());
365-
throw ex;
362+
throw new BigQueryJdbcSqlFeatureNotSupportedException("Unsupported createStatement feature.");
366363
}
367364
return createStatement();
368365
}
@@ -388,10 +385,7 @@ public Statement createStatement(
388385
if (resultSetType != ResultSet.TYPE_FORWARD_ONLY
389386
|| resultSetConcurrency != ResultSet.CONCUR_READ_ONLY
390387
|| resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
391-
BigQueryJdbcSqlFeatureNotSupportedException ex =
392-
new BigQueryJdbcSqlFeatureNotSupportedException("Unsupported createStatement feature");
393-
LOG.severe(ex, ex.getMessage());
394-
throw ex;
388+
throw new BigQueryJdbcSqlFeatureNotSupportedException("Unsupported createStatement feature");
395389
}
396390
return createStatement();
397391
}
@@ -408,20 +402,14 @@ public PreparedStatement prepareStatement(String sql) throws SQLException {
408402
@Override
409403
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
410404
if (autoGeneratedKeys != Statement.NO_GENERATED_KEYS) {
411-
BigQueryJdbcSqlFeatureNotSupportedException ex =
412-
new BigQueryJdbcSqlFeatureNotSupportedException("autoGeneratedKeys is not supported");
413-
LOG.severe(ex, ex.getMessage());
414-
throw ex;
405+
throw new BigQueryJdbcSqlFeatureNotSupportedException("autoGeneratedKeys is not supported");
415406
}
416407
return prepareStatement(sql);
417408
}
418409

419410
@Override
420411
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
421-
BigQueryJdbcSqlFeatureNotSupportedException ex =
422-
new BigQueryJdbcSqlFeatureNotSupportedException("autoGeneratedKeys is not supported");
423-
LOG.severe(ex, ex.getMessage());
424-
throw ex;
412+
throw new BigQueryJdbcSqlFeatureNotSupportedException("autoGeneratedKeys is not supported");
425413
}
426414

427415
@Override
@@ -431,10 +419,7 @@ public PreparedStatement prepareStatement(
431419
if (resultSetType != ResultSet.TYPE_FORWARD_ONLY
432420
|| resultSetConcurrency != ResultSet.CONCUR_READ_ONLY
433421
|| resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
434-
BigQueryJdbcSqlFeatureNotSupportedException ex =
435-
new BigQueryJdbcSqlFeatureNotSupportedException("Unsupported prepareStatement feature");
436-
LOG.severe(ex, ex.getMessage());
437-
throw ex;
422+
throw new BigQueryJdbcSqlFeatureNotSupportedException("Unsupported prepareStatement feature");
438423
}
439424
return prepareStatement(sql);
440425
}
@@ -445,10 +430,7 @@ public PreparedStatement prepareStatement(String sql, int resultSetType, int res
445430
LOG.finest("++enter++");
446431
if (resultSetType != ResultSet.TYPE_FORWARD_ONLY
447432
|| resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) {
448-
BigQueryJdbcSqlFeatureNotSupportedException ex =
449-
new BigQueryJdbcSqlFeatureNotSupportedException("Unsupported prepareStatement feature");
450-
LOG.severe(ex, ex.getMessage());
451-
throw ex;
433+
throw new BigQueryJdbcSqlFeatureNotSupportedException("Unsupported prepareStatement feature");
452434
}
453435
return prepareStatement(sql);
454436
}
@@ -665,9 +647,7 @@ Long getListenerPoolSize() {
665647
@Override
666648
public boolean isValid(int timeout) throws SQLException {
667649
if (timeout < 0) {
668-
BigQueryJdbcException ex = new BigQueryJdbcException("timeout must be >= 0");
669-
LOG.severe(ex, ex.getMessage());
670-
throw ex;
650+
throw new BigQueryJdbcException("timeout must be >= 0");
671651
}
672652
if (!isClosed()) {
673653
try (Statement statement = createStatement();

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ public boolean next() throws SQLException {
163163
// Advance the cursor,Potentially blocking operation
164164
this.cursor = this.buffer.take();
165165
if (this.cursor.getException() != null) {
166-
BigQueryJdbcRuntimeException ex =
167-
new BigQueryJdbcRuntimeException(this.cursor.getException());
168-
LOG.severe(ex, ex.getMessage());
169-
throw ex;
166+
throw new BigQueryJdbcRuntimeException(this.cursor.getException());
170167
}
171168
this.rowCnt++;
172169
// Check for end of stream
@@ -180,12 +177,9 @@ public boolean next() throws SQLException {
180177

181178
} catch (InterruptedException e) {
182179

183-
BigQueryJdbcRuntimeException ex =
184-
new BigQueryJdbcRuntimeException(
185-
"Error occurred while advancing the cursor. This could happen when connection is closed while we call the next method",
186-
e);
187-
LOG.severe(ex, ex.getMessage());
188-
throw ex;
180+
throw new BigQueryJdbcRuntimeException(
181+
"Error occurred while advancing the cursor. This could happen when connection is closed while we call the next method",
182+
e);
189183
}
190184
}
191185
}

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,7 @@ ExecuteResult executeJob(QueryJobConfiguration jobConfiguration)
552552
if (result instanceof Job) {
553553
job = (Job) result;
554554
} else {
555-
BigQueryJdbcException ex =
556-
new BigQueryJdbcException("Unexpected result type from queryWithTimeout");
557-
LOG.severe(ex, ex.getMessage());
558-
throw ex;
555+
throw new BigQueryJdbcException("Unexpected result type from queryWithTimeout");
559556
}
560557
} else {
561558
// Update jobId with custom JobId if jobless query is disabled.
@@ -565,16 +562,12 @@ ExecuteResult executeJob(QueryJobConfiguration jobConfiguration)
565562
}
566563

567564
if (job == null) {
568-
BigQueryJdbcException ex = new BigQueryJdbcException("Failed to create BQ Job.");
569-
LOG.severe(ex, ex.getMessage());
570-
throw ex;
565+
throw new BigQueryJdbcException("Failed to create BQ Job.");
571566
}
572567
synchronized (cancelLock) {
573568
if (isCanceled) {
574569
job.cancel();
575-
BigQueryJdbcException ex = new BigQueryJdbcException("Query was cancelled.");
576-
LOG.severe(ex, ex.getMessage());
577-
throw ex;
570+
throw new BigQueryJdbcException("Query was cancelled.");
578571
}
579572
jobId = job.getJobId();
580573
jobIds.add(jobId);

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ public PooledConnection getPooledConnection() throws SQLException {
3939
bqConnection = super.getConnection();
4040
}
4141
if (bqConnection == null) {
42-
BigQueryJdbcRuntimeException ex =
43-
new BigQueryJdbcRuntimeException(
44-
"Cannot get pooled connection: unable to get underlying physical connection");
45-
LOG.severe(ex, ex.getMessage());
46-
throw ex;
42+
throw new BigQueryJdbcRuntimeException(
43+
"Cannot get pooled connection: unable to get underlying physical connection");
4744
}
4845
Long connectionPoolSize = ((BigQueryConnection) bqConnection).getConnectionPoolSize();
4946
if (connectionPoolManager == null) {

0 commit comments

Comments
 (0)