Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkstyle fixes #303

Merged
merged 2 commits into from
Oct 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ public double getRetryDelayBackoffFactor() {
}

/**
* Returns the totalRetryPeriodMillis. Default value is {@value #DEFAULT_TOTAL_RETRY_PERIOD_MILLIS}.
* Returns the totalRetryPeriodMillis. Default value is
* {@value #DEFAULT_TOTAL_RETRY_PERIOD_MILLIS}.
*/
public long getTotalRetryPeriodMillis() {
return totalRetryPeriodMillis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
import java.util.regex.Pattern;

public abstract class ServiceOptions<
ServiceT extends Service,
ServiceRpcT,
OptionsT extends ServiceOptions<ServiceT, ServiceRpcT, OptionsT>>
ServiceT extends Service,
ServiceRpcT,
OptionsT extends ServiceOptions<ServiceT, ServiceRpcT, OptionsT>>
implements Serializable {

private static final String DEFAULT_HOST = "https://www.googleapis.com";
Expand Down Expand Up @@ -116,9 +116,9 @@ public HttpTransport create() {
* Implementations should implement {@code Serializable} wherever possible and must document
* whether or not they do support serialization.
*/
public static abstract class Clock {
public abstract static class Clock {

private static ServiceOptions.Clock DEFAULT_TIME_SOURCE = new DefaultClock();
private static final ServiceOptions.Clock DEFAULT_TIME_SOURCE = new DefaultClock();

/**
* Returns current time in milliseconds according to this clock.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import com.google.gcloud.ExceptionHandler.Interceptor;
import com.google.gcloud.ExceptionHandler.Interceptor.RetryResult;

import org.junit.rules.ExpectedException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import java.io.FileNotFoundException;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
* A Google Cloud Datastore Blob.
* This class is immutable.
*
* @see <a href="https://cloud.google.com/datastore/docs/concepts/entities">Google Cloud Datastore Entities, Properties, and Keys</a>
* @see <a href="https://cloud.google.com/datastore/docs/concepts/entities">
* Google Cloud Datastore Entities, Properties, and Keys</a>
*/
public final class Blob extends Serializable<DatastoreV1.Value> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
* }
* } </pre>
*
* @see <a href="https://cloud.google.com/datastore/docs/concepts/transactions">Google Cloud Datastore transactions</a>
* @see <a href="https://cloud.google.com/datastore/docs/concepts/transactions">
* Google Cloud Datastore transactions</a>
*
*/
public interface Transaction extends DatastoreBatchWriter, DatastoreReaderWriter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public void testAncestors() throws Exception {
BaseKey key = builder.build();
assertTrue(key.ancestors().isEmpty());
List<PathElement> path = new ArrayList<>();
path.add(PathElement.of("p1","v1"));
path.add(PathElement.of("p1", "v1"));
key = builder.ancestors(path.get(0)).build();
assertEquals(path, key.ancestors());
path.add(PathElement.of("p2","v2"));
path.add(PathElement.of("p2", "v2"));
key = builder.ancestors(path.get(1)).build();
assertEquals(path, key.ancestors());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ public void testNewBatch() {

@Test
public void testRunGqlQueryNoCasting() {
Query<Entity> query1 = Query.gqlQueryBuilder(ResultType.ENTITY, "select * from " + KIND1).build();
Query<Entity> query1 =
Query.gqlQueryBuilder(ResultType.ENTITY, "select * from " + KIND1).build();
QueryResults<Entity> results1 = datastore.run(query1);
assertTrue(results1.hasNext());
assertEquals(ENTITY1, results1.next());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

public class ListValueTest {

private static final List<Value<?>> CONTENT = ImmutableList.of(NullValue.of(), StringValue.of("foo"));
private static final List<Value<?>> CONTENT =
ImmutableList.of(NullValue.of(), StringValue.of("foo"));

@Test
public void testToBuilder() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class SerializationTest {
private static final Key KEY2 = Key.builder(KEY1, "v", 2).build();
private static final DateTime DATE_TIME1 = DateTime.now();
private static final Blob BLOB1 = Blob.copyFrom(UTF_8.encode("hello world"));
private static final Cursor CURSOR1 = Cursor.copyFrom(new byte[] {1,2});
private static final Cursor CURSOR2 = Cursor.copyFrom(new byte[]{10});
private static final Cursor CURSOR1 = Cursor.copyFrom(new byte[] {1, 2});
private static final Cursor CURSOR2 = Cursor.copyFrom(new byte[] {10});
private static final Query<?> GQL1 =
Query.gqlQueryBuilder("select * from kind1 where name = @name and age > @1")
.setBinding("name", "name1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class ValueTest {
private static final NullValue NULL_VALUE = NullValue.of();
private static final StringValue STRING_VALUE = StringValue.of("hello");
private static final RawValue RAW_VALUE = RawValue.of(STRING_VALUE.toPb());
private static final ImmutableMap<ValueType, Object[]> TYPES = ImmutableMap.<ValueType, Object[]>builder()
private static final ImmutableMap<ValueType, Object[]> TYPES =
ImmutableMap.<ValueType, Object[]>builder()
.put(ValueType.NULL, new Object[] {NullValue.class, NULL_VALUE.get()})
.put(ValueType.KEY, new Object[] {KeyValue.class, KEY})
.put(ValueType.BLOB, new Object[] {BlobValue.class, BLOB})
Expand Down Expand Up @@ -160,7 +161,7 @@ public void testIndexed() throws Exception {
@SuppressWarnings("deprecation")
@Test
public void testHasMeaning() throws Exception {
for (Value<?> value: typeToValue.values()) {
for (Value<?> value : typeToValue.values()) {
assertFalse(value.hasMeaning());
}

Expand All @@ -171,7 +172,7 @@ public void testHasMeaning() throws Exception {
@SuppressWarnings("deprecation")
@Test
public void testMeaning() throws Exception {
for (Value<?> value: typeToValue.values()) {
for (Value<?> value : typeToValue.values()) {
assertNull(value.meaning());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public static void main(String... args) {
DatastoreExample.class.getSimpleName(), actionAndParams);
return;
}
args = args.length > 3 ? Arrays.copyOfRange(args, 3, args.length): new String []{};
args = args.length > 3 ? Arrays.copyOfRange(args, 3, args.length) : new String []{};
Transaction tx = datastore.newTransaction();
try {
action.run(tx, key, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class StorageExample {

private static final Map<String, StorageAction> ACTIONS = new HashMap<>();

private static abstract class StorageAction<T> {
private abstract static class StorageAction<T> {

abstract void run(Storage storage, T request) throws Exception;

Expand All @@ -94,7 +94,7 @@ protected String params() {
}
}

private static abstract class BlobsAction extends StorageAction<BlobId[]> {
private abstract static class BlobsAction extends StorageAction<BlobId[]> {

@Override
BlobId[] parse(String... args) {
Expand Down Expand Up @@ -483,8 +483,8 @@ public void run(Storage storage, Tuple<ServiceAccountAuthCredentials, BlobInfo>
private void run(Storage storage, ServiceAccountAuthCredentials cred, BlobInfo blobInfo)
throws IOException {
Blob blob = new Blob(storage, blobInfo);
System.out.println("Signed URL: " +
blob.signUrl(1, TimeUnit.DAYS, SignUrlOption.serviceAccount(cred)));
System.out.println("Signed URL: "
+ blob.signUrl(1, TimeUnit.DAYS, SignUrlOption.serviceAccount(cred)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public enum Role {
OWNER, READER, WRITER
}

public static abstract class Entity implements Serializable {
public abstract static class Entity implements Serializable {

private static final long serialVersionUID = -2707407252771255840L;

Expand Down Expand Up @@ -69,8 +69,7 @@ public boolean equals(Object o) {
return false;
}
Entity entity = (Entity) o;
return Objects.equals(type, entity.type) &&
Objects.equals(value, entity.value);
return Objects.equals(type, entity.type) && Objects.equals(value, entity.value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.google.gcloud.storage;

import com.google.api.services.storage.model.StorageObject;
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.api.services.storage.model.StorageObject;
import com.google.common.base.MoreObjects;

import java.io.Serializable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ Builder mediaLink(String mediaLink) {
}

public Builder metadata(Map<String, String> metadata) {
this.metadata = metadata != null ?
new HashMap(metadata) : Data.<Map>nullOf(ImmutableEmptyMap.class);
this.metadata = metadata != null
? new HashMap(metadata) : Data.<Map>nullOf(ImmutableEmptyMap.class);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public com.google.api.services.storage.model.Bucket apply(BucketInfo bucketInfo)
private final Location location;
private final StorageClass storageClass;

public static abstract class DeleteRule implements Serializable {
public abstract static class DeleteRule implements Serializable {

private static final long serialVersionUID = 3137971668395933033L;
private static final String SUPPORTED_ACTION = "Delete";
Expand Down Expand Up @@ -393,7 +393,7 @@ public static Location of(String value) {
}
}

public final static class Builder {
public static final class Builder {

private String id;
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public boolean equals(Object obj) {
if (!(obj instanceof Origin)) {
return false;
}
return value.equals(((Origin)obj).value);
return value.equals(((Origin) obj).value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public BlobInfo get(BlobId blob) {
return get(blob, new BlobSourceOption[0]);
}

private static abstract class BasePageFetcher<T extends Serializable>
private abstract static class BasePageFetcher<T extends Serializable>
implements BaseListResult.NextPageFetcher<T> {

private static final long serialVersionUID = 8236329004030295223L;
Expand Down Expand Up @@ -497,7 +497,8 @@ public BatchResponse apply(BatchRequest batchRequest) {
}
List<Tuple<StorageObject, Map<StorageRpc.Option, ?>>> toUpdate =
Lists.newArrayListWithCapacity(batchRequest.toUpdate().size());
for (Map.Entry<BlobInfo, Iterable<BlobTargetOption>> entry : batchRequest.toUpdate().entrySet()) {
for (Map.Entry<BlobInfo, Iterable<BlobTargetOption>> entry :
batchRequest.toUpdate().entrySet()) {
BlobInfo blobInfo = entry.getKey();
Map<StorageRpc.Option, ?> optionsMap =
optionMap(blobInfo.generation(), blobInfo.metageneration(), entry.getValue());
Expand Down Expand Up @@ -582,7 +583,7 @@ public URL signUrl(BlobInfo blobInfo, long duration, TimeUnit unit, SignUrlOptio
"Signing key was not provided and could not be derived");
cred = (ServiceAccountAuthCredentials) this.options().authCredentials();
}
// construct signature data - see https://cloud.google.com/storage/docs/access-control#Signed-URLs
// construct signature - see https://cloud.google.com/storage/docs/access-control#Signed-URLs
StringBuilder stBuilder = new StringBuilder();
if (optionMap.containsKey(SignUrlOption.Option.HTTP_METHOD)) {
stBuilder.append(optionMap.get(SignUrlOption.Option.HTTP_METHOD));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
package com.google.gcloud.storage.testing;

import com.google.gcloud.AuthCredentials;
import com.google.gcloud.storage.BlobInfo;
import com.google.gcloud.RetryParams;
import com.google.gcloud.storage.BlobInfo;
import com.google.gcloud.storage.Storage;
import com.google.gcloud.storage.StorageException;
import com.google.gcloud.storage.StorageOptions;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
import static org.junit.Assert.assertFalse;

import com.google.common.collect.ImmutableList;
import java.util.Iterator;

import org.junit.Before;
import org.junit.Test;

import java.util.Iterator;

public class BlobListResultTest {

private static final Iterable<BlobInfo> FIRST_PAGE_RESULTS = ImmutableList.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@

import com.google.common.collect.ImmutableList;
import com.google.gcloud.storage.BatchResponse.Result;

import org.easymock.Capture;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.easymock.Capture;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class BucketTest {

Expand Down
Loading