Skip to content

Commit 58015ef

Browse files
committed
add severe logs
1 parent 2296e03 commit 58015ef

5 files changed

Lines changed: 20 additions & 1 deletion

File tree

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,27 @@ public final int getBaseType() {
7171

7272
@Override
7373
public final Object getArray(Map<String, Class<?>> map) throws SQLException {
74+
LOG.severe(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
7475
throw new BigQueryJdbcSqlFeatureNotSupportedException(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
7576
}
7677

7778
@Override
7879
public final Object getArray(long index, int count, Map<String, Class<?>> map)
7980
throws SQLException {
81+
LOG.severe(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
8082
throw new BigQueryJdbcSqlFeatureNotSupportedException(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
8183
}
8284

8385
@Override
8486
public final ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException {
87+
LOG.severe(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
8588
throw new BigQueryJdbcSqlFeatureNotSupportedException(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
8689
}
8790

8891
@Override
8992
public final ResultSet getResultSet(long index, int count, Map<String, Class<?>> map)
9093
throws SQLException {
94+
LOG.severe(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
9195
throw new BigQueryJdbcSqlFeatureNotSupportedException(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
9296
}
9397

@@ -106,6 +110,7 @@ protected Object getArrayInternal(int fromIndex, int toIndexExclusive) {
106110
protected void ensureValid() throws IllegalStateException {
107111
LOG.finest("++enter++");
108112
if (!this.valid) {
113+
LOG.severe(INVALID_ARRAY);
109114
throw new IllegalStateException(INVALID_ARRAY);
110115
}
111116
}
@@ -127,6 +132,8 @@ protected Tuple<Integer, Integer> createRange(long index, int count, int size)
127132
// jdbc array follows 1 based array indexing
128133
long normalisedFromIndex = index - 1;
129134
if (normalisedFromIndex + count > size) {
135+
LOG.severe(
136+
"The array index is out of range: %d, number of elements: %d.", index + count, size);
130137
throw new IllegalArgumentException(
131138
String.format(
132139
"The array index is out of range: %d, number of elements: %d.", index + count, size));
@@ -166,7 +173,7 @@ public String toString() {
166173
}
167174
return Arrays.deepToString(array);
168175
} catch (SQLException e) {
169-
LOG.severe(e, "Error converting array to string");
176+
LOG.warning("Error converting array to string");
170177
return "[Error converting array to string: " + e.getMessage() + "]";
171178
}
172179
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ abstract class BigQueryBaseStruct implements java.sql.Struct {
4242

4343
@Override
4444
public final String getSQLTypeName() throws SQLException {
45+
LOG.severe(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
4546
throw new BigQueryJdbcSqlFeatureNotSupportedException(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
4647
}
4748

4849
@Override
4950
public final Object[] getAttributes(Map<String, Class<?>> map) throws SQLException {
51+
LOG.severe(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
5052
throw new BigQueryJdbcSqlFeatureNotSupportedException(CUSTOMER_TYPE_MAPPING_NOT_SUPPORTED);
5153
}
5254

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ else if (referenceQueueJsonRs != null) {
113113
reference.clear();
114114
}
115115
} else {
116+
LOG.severe("Null Reference Queue");
116117
throw new BigQueryJdbcRuntimeException("Null Reference Queue");
117118
}
118119
} catch (InterruptedException ex) {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ static Map<String, String> parseProxyProperties(DataSource ds, String callerClas
7171
String proxyPort = ds.getProxyPort();
7272
if (proxyPort != null) {
7373
if (!Pattern.compile(validPortRegex).matcher(proxyPort).find()) {
74+
LOG.severe(
75+
"Illegal port number provided %s. Please provide a valid port number.", proxyPort);
7476
throw new IllegalArgumentException(
7577
String.format(
7678
"Illegal port number provided %s. Please provide a valid port number.", proxyPort));
@@ -89,18 +91,23 @@ static Map<String, String> parseProxyProperties(DataSource ds, String callerClas
8991
boolean isMissingProxyHostOrPortWhenProxySet =
9092
(proxyHost == null && proxyPort != null) || (proxyHost != null && proxyPort == null);
9193
if (isMissingProxyHostOrPortWhenProxySet) {
94+
LOG.severe(
95+
"Both ProxyHost and ProxyPort parameters need to be specified. No defaulting behavior occurs.");
9296
throw new IllegalArgumentException(
9397
"Both ProxyHost and ProxyPort parameters need to be specified. No defaulting behavior"
9498
+ " occurs.");
9599
}
96100
boolean isMissingProxyUidOrPwdWhenAuthSet =
97101
(proxyUid == null && proxyPwd != null) || (proxyUid != null && proxyPwd == null);
98102
if (isMissingProxyUidOrPwdWhenAuthSet) {
103+
LOG.severe("Both ProxyUid and ProxyPwd parameters need to be specified for authentication.");
99104
throw new IllegalArgumentException(
100105
"Both ProxyUid and ProxyPwd parameters need to be specified for authentication.");
101106
}
102107
boolean isProxyAuthSetWithoutProxySettings = proxyUid != null && proxyHost == null;
103108
if (isProxyAuthSetWithoutProxySettings) {
109+
LOG.severe(
110+
"Proxy authentication provided via connection string with no proxy host or port set.");
104111
throw new IllegalArgumentException(
105112
"Proxy authentication provided via connection string with no proxy host or port set.");
106113
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ void setParameter(int parameterIndex, Object value, Class type)
104104

105105
private void checkValidIndex(int parameterIndex) {
106106
if (parameterIndex > this.parametersArraySize) {
107+
LOG.severe("All parameters already provided.");
107108
throw new IndexOutOfBoundsException("All parameters already provided.");
108109
}
109110
}
@@ -152,6 +153,7 @@ void setParameter(
152153
LOG.finest("++enter++");
153154
LOG.finest("setParameter called by : %s", type.getName());
154155
if (paramName == null || paramName.isEmpty()) {
156+
LOG.severe("paramName cannot be null or empty");
155157
throw new IllegalArgumentException("paramName cannot be null or empty");
156158
}
157159
BigQueryJdbcParameter parameter = null;

0 commit comments

Comments
 (0)