Skip to content

Commit cb97c07

Browse files
committed
---
yaml --- r: 2709 b: refs/heads/update-datastore c: 67e5dfc h: refs/heads/master i: 2707: 00b1a13
1 parent d94cad6 commit cb97c07

7 files changed

Lines changed: 13 additions & 17 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: acf260ce07f7fdd0729682d74c15c5c88abf7c84
8+
refs/heads/update-datastore: 67e5dfce1f7d6903fc75a67d472c85ebb900258e
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ protected Set<Error> retryableErrors() {
7676
* @throws BigQueryException when {@code ex} was caused by a {@code BigQueryException}
7777
* @throws RetryInterruptedException when {@code ex} is a {@code RetryInterruptedException}
7878
*/
79-
public static BigQueryException translateAndThrow(RetryHelperException ex) {
80-
BaseServiceException.translateAndThrow(ex);
79+
static BaseServiceException translateAndThrow(RetryHelperException ex) {
80+
BaseServiceException.translateAndPropagateIfPossible(ex);
8181
throw new BigQueryException(UNKNOWN_CODE, ex.getMessage());
8282
}
8383
}

branches/update-datastore/gcloud-java-core/src/main/java/com/google/gcloud/BaseServiceException.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,12 @@ protected static String message(IOException exception) {
184184
return exception.getMessage();
185185
}
186186

187-
protected static BaseServiceException translateAndThrow(
188-
RetryHelper.RetryHelperException ex) {
187+
protected static void translateAndPropagateIfPossible(RetryHelper.RetryHelperException ex) {
189188
if (ex.getCause() instanceof BaseServiceException) {
190189
throw (BaseServiceException) ex.getCause();
191190
}
192191
if (ex instanceof RetryHelper.RetryInterruptedException) {
193192
RetryHelper.RetryInterruptedException.propagate();
194193
}
195-
return null;
196194
}
197195
}

branches/update-datastore/gcloud-java-core/src/test/java/com/google/gcloud/BaseServiceExceptionTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,12 @@ public void testBaseServiceException() {
137137
@Test
138138
public void testTranslateAndThrow() throws Exception {
139139
BaseServiceException cause = new BaseServiceException(CODE, MESSAGE, REASON, IDEMPOTENT);
140-
RetryHelper.RetryHelperException exceptionMock = createMock(RetryHelper.RetryHelperException.class);
140+
RetryHelper.RetryHelperException exceptionMock =
141+
createMock(RetryHelper.RetryHelperException.class);
141142
expect(exceptionMock.getCause()).andReturn(cause).times(2);
142143
replay(exceptionMock);
143144
try {
144-
BaseServiceException ex = BaseServiceException.translateAndThrow(exceptionMock);
145-
if (ex != null) {
146-
throw ex;
147-
}
145+
BaseServiceException.translateAndPropagateIfPossible(exceptionMock);
148146
} catch (BaseServiceException ex) {
149147
assertEquals(CODE, ex.code());
150148
assertEquals(MESSAGE, ex.getMessage());

branches/update-datastore/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ protected Set<Error> retryableErrors() {
6363
* @throws DatastoreException when {@code ex} was caused by a {@code DatastoreException}
6464
* @throws RetryInterruptedException when {@code ex} is a {@code RetryInterruptedException}
6565
*/
66-
public static DatastoreException translateAndThrow(RetryHelperException ex) {
67-
BaseServiceException.translateAndThrow(ex);
66+
static DatastoreException translateAndThrow(RetryHelperException ex) {
67+
BaseServiceException.translateAndPropagateIfPossible(ex);
6868
throw new DatastoreException(UNKNOWN_CODE, ex.getMessage(), null);
6969
}
7070

branches/update-datastore/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ protected Set<Error> retryableErrors() {
6868
* ResourceManagerException}
6969
* @throws RetryInterruptedException when {@code ex} is a {@code RetryInterruptedException}
7070
*/
71-
public static ResourceManagerException translateAndThrow(RetryHelperException ex) {
72-
BaseServiceException.translateAndThrow(ex);
71+
static ResourceManagerException translateAndThrow(RetryHelperException ex) {
72+
BaseServiceException.translateAndPropagateIfPossible(ex);
7373
throw new ResourceManagerException(UNKNOWN_CODE, ex.getMessage());
7474
}
7575
}

branches/update-datastore/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ protected Set<Error> retryableErrors() {
6969
* @throws StorageException when {@code ex} was caused by a {@code StorageException}
7070
* @throws RetryInterruptedException when {@code ex} is a {@code RetryInterruptedException}
7171
*/
72-
public static StorageException translateAndThrow(RetryHelperException ex) {
73-
BaseServiceException.translateAndThrow(ex);
72+
static StorageException translateAndThrow(RetryHelperException ex) {
73+
BaseServiceException.translateAndPropagateIfPossible(ex);
7474
throw new StorageException(UNKNOWN_CODE, ex.getMessage());
7575
}
7676
}

0 commit comments

Comments
 (0)