Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ StatementType getStatementType(QueryJobConfiguration queryJobConfiguration) thro
} catch (BigQueryException ex) {
if (ex.getMessage().contains("Syntax error")) {
throw new BigQueryJdbcSqlSyntaxErrorException(
"BigQueryException during getStatementType", ex);
"BigQueryException during getStatementType: " + ex.getMessage(), ex);
}
throw new BigQueryJdbcException("BigQueryException during getStatementType", ex);
throw new BigQueryJdbcException("BigQueryException during getStatementType: " + ex.getMessage(), ex);
Comment on lines +344 to +346
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for wrapping BigQueryException and surfacing its message is duplicated across getStatementType, getQueryStatistics, and runQuery. This duplication makes the code harder to maintain and increases the risk of inconsistencies. To align with repository practices, consider moving this shared logic to a separate helper or utility class.

References
  1. If code is duplicated and needs to be shared, move it to a separate helper/utility class.

}
QueryStatistics statistics = job.getStatistics();
return statistics.getStatementType();
Expand Down Expand Up @@ -375,9 +375,9 @@ QueryStatistics getQueryStatistics(QueryJobConfiguration queryJobConfiguration)
} catch (BigQueryException ex) {
if (ex.getMessage().contains("Syntax error")) {
throw new BigQueryJdbcSqlSyntaxErrorException(
"BigQueryException during getQueryStatistics", ex);
"BigQueryException during getQueryStatistics: " + ex.getMessage(), ex);
}
throw new BigQueryJdbcException("BigQueryException during getQueryStatistics", ex);
throw new BigQueryJdbcException("BigQueryException during getQueryStatistics: " + ex.getMessage(), ex);
}
}

Expand Down Expand Up @@ -644,9 +644,9 @@ void runQuery(String query, QueryJobConfiguration jobConfiguration)
throw new BigQueryJdbcRuntimeException("Interrupted during runQuery", ex);
} catch (BigQueryException ex) {
if (ex.getMessage().contains("Syntax error")) {
throw new BigQueryJdbcSqlSyntaxErrorException("BigQueryException during runQuery", ex);
throw new BigQueryJdbcSqlSyntaxErrorException("BigQueryException during runQuery: " + ex.getMessage(), ex);
}
throw new BigQueryJdbcException("BigQueryException during runQuery", ex);
throw new BigQueryJdbcException("BigQueryException during runQuery: " + ex.getMessage(), ex);
Comment on lines +647 to +649
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The changes modify the error messages returned by the JDBC driver, which is a user-facing change. These changes should be accompanied by unit tests to verify that the underlying BigQueryException message is correctly surfaced and that the logic handles edge cases (e.g., null or empty messages) gracefully. Relying on manual verification of the built JAR is insufficient for maintaining code quality.

}
}

Expand Down
Loading