Skip to content

Commit eee92bc

Browse files
committed
---
yaml --- r: 2185 b: refs/heads/pubsub-alpha c: 9fba603 h: refs/heads/master i: 2183: cc34e4f
1 parent b51da12 commit eee92bc

5 files changed

Lines changed: 47 additions & 2 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ refs/heads/master: 689bbb466df4b2d5d2483d6edb8ac5c7c7f7c6fa
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
6-
refs/heads/pubsub-alpha: 3026e77428e35d47f2e68541849082710394a8c8
6+
refs/heads/pubsub-alpha: 9fba6035e3f21f90848b12c35a2115cb30bccbb6
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
88
refs/heads/update-datastore: 482954f2c5055231e5b3122ea91d2ba00ce8187c
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryException.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.google.gcloud.bigquery;
1818

19+
import com.google.api.client.googleapis.json.GoogleJsonError;
20+
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
1921
import com.google.common.collect.ImmutableSet;
2022
import com.google.gcloud.BaseServiceException;
2123
import com.google.gcloud.RetryHelper.RetryHelperException;
@@ -53,7 +55,16 @@ public BigQueryException(int code, String message, BigQueryError error) {
5355

5456
public BigQueryException(IOException exception) {
5557
super(exception, true);
56-
this.error = null;
58+
BigQueryError bigqueryError = null;
59+
if (exception instanceof GoogleJsonResponseException) {
60+
GoogleJsonError error = ((GoogleJsonResponseException) exception).getDetails();
61+
if (error != null && error.getErrors() != null && !error.getErrors().isEmpty()) {
62+
GoogleJsonError.ErrorInfo errorInfo = error.getErrors().get(0);
63+
bigqueryError = new BigQueryError(errorInfo.getReason(), errorInfo.getLocation(),
64+
errorInfo.getMessage(), (String) error.get("debugInfo"));
65+
}
66+
}
67+
this.error = bigqueryError;
5768
}
5869

5970
/**

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ExternalTableInfo.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import com.google.api.services.bigquery.model.Table;
2222
import com.google.common.base.MoreObjects.ToStringHelper;
2323

24+
import java.util.Objects;
25+
2426
/**
2527
* Google BigQuery External Table information. BigQuery's external tables are tables whose data
2628
* reside outside of BigQuery but can be queried as normal BigQuery tables. External tables are
@@ -103,6 +105,17 @@ ToStringHelper toStringHelper() {
103105
return super.toStringHelper().add("configuration", configuration);
104106
}
105107

108+
@Override
109+
public boolean equals(Object obj) {
110+
return obj instanceof ExternalTableInfo
111+
&& Objects.equals(toPb(), ((ExternalTableInfo) obj).toPb());
112+
}
113+
114+
@Override
115+
public int hashCode() {
116+
return Objects.hash(super.hashCode(), configuration);
117+
}
118+
106119
@Override
107120
Table toPb() {
108121
Table tablePb = super.toPb();

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/TableInfo.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ ToStringHelper toStringHelper() {
213213
.add("streamingBuffer", streamingBuffer);
214214
}
215215

216+
@Override
217+
public boolean equals(Object obj) {
218+
return obj instanceof TableInfo && Objects.equals(toPb(), ((TableInfo) obj).toPb());
219+
}
220+
221+
@Override
222+
public int hashCode() {
223+
return Objects.hash(super.hashCode(), location, streamingBuffer);
224+
}
225+
216226
@Override
217227
Table toPb() {
218228
Table tablePb = super.toPb();

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ViewInfo.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.common.collect.Lists;
2626

2727
import java.util.List;
28+
import java.util.Objects;
2829

2930
/**
3031
* Google BigQuery View Table information. BigQuery's views are logical views, not materialized
@@ -143,6 +144,16 @@ ToStringHelper toStringHelper() {
143144
.add("userDefinedFunctions", userDefinedFunctions);
144145
}
145146

147+
@Override
148+
public boolean equals(Object obj) {
149+
return obj instanceof ViewInfo && Objects.equals(toPb(), ((ViewInfo) obj).toPb());
150+
}
151+
152+
@Override
153+
public int hashCode() {
154+
return Objects.hash(super.hashCode(), query, userDefinedFunctions);
155+
}
156+
146157
@Override
147158
Table toPb() {
148159
Table tablePb = super.toPb();

0 commit comments

Comments
 (0)