Skip to content

Commit 93fe6bd

Browse files
committed
Make exception classes final with public constructors
1 parent 4b8f3ea commit 93fe6bd

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryException.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @see <a href="https://cloud.google.com/bigquery/troubleshooting-errors">Google Cloud
3232
* BigQuery error codes</a>
3333
*/
34-
public class BigQueryException extends BaseServiceException {
34+
public final class BigQueryException extends BaseServiceException {
3535

3636
// see: https://cloud.google.com/bigquery/troubleshooting-errors
3737
private static final Set<Error> RETRYABLE_ERRORS = ImmutableSet.of(
@@ -47,12 +47,12 @@ public BigQueryException(int code, String message) {
4747
this(code, message, (Throwable) null);
4848
}
4949

50-
BigQueryException(int code, String message, Throwable cause) {
50+
public BigQueryException(int code, String message, Throwable cause) {
5151
super(code, message, null, true, cause);
5252
this.error = null;
5353
}
5454

55-
BigQueryException(int code, String message, BigQueryError error) {
55+
public BigQueryException(int code, String message, BigQueryError error) {
5656
super(code, message, error != null ? error.reason() : null, true);
5757
this.error = error;
5858
}

gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
* @see <a href="https://cloud.google.com/datastore/docs/concepts/errors#Error_Codes">Google Cloud
3131
* Datastore error codes</a>
3232
*/
33-
public class DatastoreException extends BaseServiceException {
33+
public final class DatastoreException extends BaseServiceException {
3434

3535
// see https://cloud.google.com/datastore/docs/concepts/errors#Error_Codes"
3636
private static final Set<Error> RETRYABLE_ERRORS = ImmutableSet.of(
3737
new Error(10, "ABORTED"), new Error(4, "DEADLINE_EXCEEDED"), new Error(14, "UNAVAILABLE"));
3838
private static final long serialVersionUID = 2663750991205874435L;
3939

40-
DatastoreException(int code, String message, String reason) {
40+
public DatastoreException(int code, String message, String reason) {
4141
this(code, message, reason, null);
4242
}
4343

gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/**
2929
* DNS service exception.
3030
*/
31-
public class DnsException extends BaseServiceException {
31+
public final class DnsException extends BaseServiceException {
3232

3333
// see: https://cloud.google.com/dns/troubleshooting
3434
private static final Set<Error> RETRYABLE_ERRORS = ImmutableSet.of(
@@ -48,7 +48,7 @@ public DnsException(GoogleJsonError error, boolean idempotent) {
4848
super(error, idempotent);
4949
}
5050

51-
DnsException(int code, String message, Throwable cause) {
51+
public DnsException(int code, String message, Throwable cause) {
5252
super(code, message, null, true, cause);
5353
}
5454

gcloud-java-dns/src/test/java/com/google/cloud/dns/ZoneTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class ZoneTest {
6464
ChangeRequestInfo.builder().generatedId("someid").build();
6565
private static final ChangeRequestInfo CHANGE_REQUEST_NO_ID =
6666
ChangeRequestInfo.builder().build();
67-
private static final DnsException EXCEPTION = createStrictMock(DnsException.class);
67+
private static final DnsException EXCEPTION = new DnsException(-1, "message", null);
6868
private static final DnsOptions OPTIONS = createStrictMock(DnsOptions.class);
6969

7070
private Dns dns;

gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerException.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* @see <a href="https://cloud.google.com/resource-manager/v1/errors/core_errors">Google Cloud
3131
* Resource Manager error codes</a>
3232
*/
33-
public class ResourceManagerException extends BaseServiceException {
33+
public final class ResourceManagerException extends BaseServiceException {
3434

3535
// see https://cloud.google.com/resource-manager/v1/errors/core_errors
3636
private static final Set<Error> RETRYABLE_ERRORS = ImmutableSet.of(
@@ -47,11 +47,11 @@ public class ResourceManagerException extends BaseServiceException {
4747
new Error(403, "variableTermLimitExceeded"));
4848
private static final long serialVersionUID = -9207194488966554136L;
4949

50-
ResourceManagerException(int code, String message) {
50+
public ResourceManagerException(int code, String message) {
5151
this(code, message, null);
5252
}
5353

54-
ResourceManagerException(int code, String message, Throwable cause) {
54+
public ResourceManagerException(int code, String message, Throwable cause) {
5555
super(code, message, null, true, cause);
5656
}
5757

gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @see <a href="https://cloud.google.com/storage/docs/json_api/v1/status-codes">Google Cloud
3232
* Storage error codes</a>
3333
*/
34-
public class StorageException extends BaseServiceException {
34+
public final class StorageException extends BaseServiceException {
3535

3636
// see: https://cloud.google.com/storage/docs/resumable-uploads-xml#practices
3737
private static final Set<Error> RETRYABLE_ERRORS = ImmutableSet.of(
@@ -49,7 +49,7 @@ public StorageException(int code, String message) {
4949
this(code, message, null);
5050
}
5151

52-
StorageException(int code, String message, Throwable cause) {
52+
public StorageException(int code, String message, Throwable cause) {
5353
super(code, message, null, true, cause);
5454
}
5555

0 commit comments

Comments
 (0)