Skip to content

Commit

Permalink
Make exception classes final with public constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Apr 21, 2016
1 parent 4b8f3ea commit 93fe6bd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @see <a href="https://cloud.google.com/bigquery/troubleshooting-errors">Google Cloud
* BigQuery error codes</a>
*/
public class BigQueryException extends BaseServiceException {
public final class BigQueryException extends BaseServiceException {

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

BigQueryException(int code, String message, Throwable cause) {
public BigQueryException(int code, String message, Throwable cause) {
super(code, message, null, true, cause);
this.error = null;
}

BigQueryException(int code, String message, BigQueryError error) {
public BigQueryException(int code, String message, BigQueryError error) {
super(code, message, error != null ? error.reason() : null, true);
this.error = error;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
* @see <a href="https://cloud.google.com/datastore/docs/concepts/errors#Error_Codes">Google Cloud
* Datastore error codes</a>
*/
public class DatastoreException extends BaseServiceException {
public final class DatastoreException extends BaseServiceException {

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

DatastoreException(int code, String message, String reason) {
public DatastoreException(int code, String message, String reason) {
this(code, message, reason, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* DNS service exception.
*/
public class DnsException extends BaseServiceException {
public final class DnsException extends BaseServiceException {

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

DnsException(int code, String message, Throwable cause) {
public DnsException(int code, String message, Throwable cause) {
super(code, message, null, true, cause);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class ZoneTest {
ChangeRequestInfo.builder().generatedId("someid").build();
private static final ChangeRequestInfo CHANGE_REQUEST_NO_ID =
ChangeRequestInfo.builder().build();
private static final DnsException EXCEPTION = createStrictMock(DnsException.class);
private static final DnsException EXCEPTION = new DnsException(-1, "message", null);
private static final DnsOptions OPTIONS = createStrictMock(DnsOptions.class);

private Dns dns;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @see <a href="https://cloud.google.com/resource-manager/v1/errors/core_errors">Google Cloud
* Resource Manager error codes</a>
*/
public class ResourceManagerException extends BaseServiceException {
public final class ResourceManagerException extends BaseServiceException {

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

ResourceManagerException(int code, String message) {
public ResourceManagerException(int code, String message) {
this(code, message, null);
}

ResourceManagerException(int code, String message, Throwable cause) {
public ResourceManagerException(int code, String message, Throwable cause) {
super(code, message, null, true, cause);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @see <a href="https://cloud.google.com/storage/docs/json_api/v1/status-codes">Google Cloud
* Storage error codes</a>
*/
public class StorageException extends BaseServiceException {
public final class StorageException extends BaseServiceException {

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

StorageException(int code, String message, Throwable cause) {
public StorageException(int code, String message, Throwable cause) {
super(code, message, null, true, cause);
}

Expand Down

0 comments on commit 93fe6bd

Please sign in to comment.