Skip to content

Commit 4b19c20

Browse files
committed
refactor Severe method signature
1 parent 6b55aef commit 4b19c20

30 files changed

Lines changed: 111 additions & 159 deletions

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/exception/BigQueryConversionException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ public class BigQueryConversionException extends SQLException {
2828

2929
public BigQueryConversionException(String message, Throwable cause) {
3030
super(message, cause);
31-
LOG.severe(this, message);
31+
LOG.severe(message, this);
3232
}
3333
}

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/exception/BigQueryJdbcCoercionException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ public class BigQueryJdbcCoercionException extends RuntimeException {
3535
*/
3636
public BigQueryJdbcCoercionException(Exception cause) {
3737
super("Coercion error", cause);
38-
LOG.severe(this, "Coercion error");
38+
LOG.severe("Coercion error", this);
3939
}
4040
}

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/exception/BigQueryJdbcCoercionNotFoundException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public BigQueryJdbcCoercionNotFoundException(Class<?> source, Class<?> target) {
3939
String.format(
4040
"Coercion not found for [%s -> %s] conversion",
4141
source.getCanonicalName(), target.getCanonicalName()));
42-
LOG.severe(this, this.getMessage());
42+
LOG.severe(this.getMessage(), this);
4343
}
4444
}

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/exception/BigQueryJdbcException.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class BigQueryJdbcException extends SQLException {
3232
*/
3333
public BigQueryJdbcException(String message) {
3434
super(message);
35-
LOG.severe(this, message);
35+
LOG.severe(message, this);
3636
}
3737

3838
/**
@@ -42,18 +42,19 @@ public BigQueryJdbcException(String message) {
4242
*/
4343
public BigQueryJdbcException(InterruptedException ex) {
4444
super(ex);
45-
LOG.severe(this, ex.getMessage());
45+
LOG.severe(ex.getMessage(), this);
4646
}
4747

4848
/**
4949
* Constructs a new BigQueryJdbcException from BigQueryException
5050
*
51+
* @param message Specific message that is being added to the Exception.
5152
* @param ex The BigQueryException to be thrown.
5253
*/
5354
public BigQueryJdbcException(String message, BigQueryException ex) {
5455
super(message, ex);
5556
this.bigQueryException = ex;
56-
LOG.severe(this, ex.getMessage());
57+
LOG.severe(ex.getMessage(), this);
5758
}
5859

5960
/**
@@ -64,7 +65,7 @@ public BigQueryJdbcException(String message, BigQueryException ex) {
6465
*/
6566
public BigQueryJdbcException(String message, Throwable cause) {
6667
super(message, cause);
67-
LOG.severe(this, message);
68+
LOG.severe(message, this);
6869
}
6970

7071
/**
@@ -75,7 +76,7 @@ public BigQueryJdbcException(String message, Throwable cause) {
7576
*/
7677
public BigQueryJdbcException(Throwable cause) {
7778
super(cause);
78-
LOG.severe(this, cause.getMessage());
79+
LOG.severe(cause.getMessage(), this);
7980
}
8081

8182
public BigQueryException getBigQueryException() {

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/exception/BigQueryJdbcRuntimeException.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class BigQueryJdbcRuntimeException extends RuntimeException {
3030
*/
3131
public BigQueryJdbcRuntimeException(String message) {
3232
super(message);
33-
LOG.severe(this, message);
33+
LOG.severe(message, this);
3434
}
3535

3636
/**
@@ -40,7 +40,7 @@ public BigQueryJdbcRuntimeException(String message) {
4040
*/
4141
public BigQueryJdbcRuntimeException(Throwable ex) {
4242
super(ex);
43-
LOG.severe(this, ex.getMessage());
43+
LOG.severe(ex.getMessage(), this);
4444
}
4545

4646
/**
@@ -51,11 +51,11 @@ public BigQueryJdbcRuntimeException(Throwable ex) {
5151
*/
5252
public BigQueryJdbcRuntimeException(String message, InterruptedException ex) {
5353
super(message, ex);
54-
LOG.severe(this, message);
54+
LOG.severe(message, this);
5555
}
5656

5757
public BigQueryJdbcRuntimeException(String message, Throwable ex) {
5858
super(message, ex);
59-
LOG.severe(this, message);
59+
LOG.severe(message, this);
6060
}
6161
}

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/exception/BigQueryJdbcSqlFeatureNotSupportedException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class BigQueryJdbcSqlFeatureNotSupportedException extends SQLFeatureNotSu
3131
*/
3232
public BigQueryJdbcSqlFeatureNotSupportedException(String message) {
3333
super(message);
34-
LOG.severe(this, message);
34+
LOG.severe(message, this);
3535
}
3636

3737
/**
@@ -41,6 +41,6 @@ public BigQueryJdbcSqlFeatureNotSupportedException(String message) {
4141
*/
4242
public BigQueryJdbcSqlFeatureNotSupportedException(BigQueryException ex) {
4343
super(ex);
44-
LOG.severe(this, ex.getMessage());
44+
LOG.severe(ex.getMessage(), this);
4545
}
4646
}

java-bigquery/google-cloud-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/exception/BigQueryJdbcSqlSyntaxErrorException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public class BigQueryJdbcSqlSyntaxErrorException extends SQLSyntaxErrorException
3636
*/
3737
public BigQueryJdbcSqlSyntaxErrorException(BigQueryException ex) {
3838
super(ex.getMessage(), "Incorrect SQL syntax.");
39-
LOG.severe(this, ex.getMessage());
39+
LOG.severe(ex.getMessage(), this);
4040
}
4141

4242
public BigQueryJdbcSqlSyntaxErrorException(String message, BigQueryException ex) {
4343
super(message, ex);
44-
LOG.severe(this, message);
44+
LOG.severe(message, this);
4545
}
4646
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public boolean next() throws SQLException {
218218
IllegalStateException ex =
219219
new IllegalStateException(
220220
"currentNestedBatch/JsonStringArrayList can not be null working with the nested record");
221-
LOG.severe(ex, ex.getMessage());
221+
LOG.severe(ex.getMessage(), ex);
222222
throw ex;
223223
}
224224
if (this.nestedRowIndex < (this.toIndexExclusive - 1)) {
@@ -288,13 +288,13 @@ private Object getObjectInternal(int columnIndex) throws SQLException {
288288
if (!(columnIndex == 1 || columnIndex == 2)) {
289289
IllegalArgumentException ex =
290290
new IllegalArgumentException("Column index is required to be 1 or 2 for nested arrays");
291-
LOG.severe(ex, ex.getMessage());
291+
LOG.severe(ex.getMessage(), ex);
292292
throw ex;
293293
}
294294
if (this.currentNestedBatch.getNestedRecords() == null) {
295295
IllegalStateException ex =
296296
new IllegalStateException("JsonStringArrayList cannot be null for nested records.");
297-
LOG.severe(ex, ex.getMessage());
297+
LOG.severe(ex.getMessage(), ex);
298298
throw ex;
299299
}
300300
// For Arrays the first column is Index, ref:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected void ensureValid() throws IllegalStateException {
107107
LOG.finest("++enter++");
108108
if (!this.valid) {
109109
IllegalStateException ex = new IllegalStateException(INVALID_ARRAY);
110-
LOG.severe(ex, INVALID_ARRAY);
110+
LOG.severe(INVALID_ARRAY, ex);
111111
throw ex;
112112
}
113113
}
@@ -134,7 +134,7 @@ protected Tuple<Integer, Integer> createRange(long index, int count, int size)
134134
String.format(
135135
"The array index is out of range: %d, number of elements: %d.",
136136
index + count, size));
137-
LOG.severe(ex, ex.getMessage());
137+
LOG.severe(ex.getMessage(), ex);
138138
throw ex;
139139
}
140140
long toIndex = normalisedFromIndex + count;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected SQLException createCoercionException(
126126
SQLException ex =
127127
new SQLException(
128128
"For a nested ResultSet from an Array, columnIndex must be 1 or 2.", cause);
129-
LOG.severe(ex, ex.getMessage());
129+
LOG.severe(ex.getMessage(), ex);
130130
throw ex;
131131
}
132132
} else {
@@ -148,23 +148,23 @@ private StandardSQLTypeName getStandardSQLTypeName(int columnIndex) throws SQLEx
148148
} else if (columnIndex == 2) {
149149
if (this.schema == null || this.schema.getFields().isEmpty()) {
150150
SQLException ex = new SQLException("Schema not available for nested result set.");
151-
LOG.severe(ex, "Schema not available for nested result set.");
151+
LOG.severe("Schema not available for nested result set.", ex);
152152
throw ex;
153153
}
154154
Field arrayField = this.schema.getFields().get(0);
155155
return arrayField.getType().getStandardType();
156156
} else {
157157
SQLException ex =
158158
new SQLException("For a nested ResultSet from an Array, columnIndex must be 1 or 2.");
159-
LOG.severe(ex, "For a nested ResultSet from an Array, columnIndex must be 1 or 2.");
159+
LOG.severe("For a nested ResultSet from an Array, columnIndex must be 1 or 2.", ex);
160160
throw ex;
161161
}
162162
} else {
163163
if (this.schemaFieldList == null
164164
|| columnIndex > this.schemaFieldList.size()
165165
|| columnIndex < 1) {
166166
SQLException ex = new SQLException("Invalid column index: " + columnIndex);
167-
LOG.severe(ex, "Invalid column index: " + columnIndex);
167+
LOG.severe("Invalid column index: " + columnIndex, ex);
168168
throw ex;
169169
}
170170
Field field = this.schemaFieldList.get(columnIndex - 1);
@@ -228,7 +228,7 @@ protected int getColumnIndex(String columnLabel) throws SQLException {
228228
checkClosed();
229229
if (columnLabel == null) {
230230
SQLException ex = new SQLException("Column label cannot be null");
231-
LOG.severe(ex, ex.getMessage());
231+
LOG.severe(ex.getMessage(), ex);
232232
throw ex;
233233
}
234234
// use schema to get the column index, add 1 for SQL index

0 commit comments

Comments
 (0)