Skip to content

Commit 9d201a0

Browse files
author
Ajay Kannan
committed
Fix codacy and spacing bugs
1 parent 4d8d986 commit 9d201a0

8 files changed

Lines changed: 91 additions & 91 deletions

File tree

gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/InsertAllRequest.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ public class InsertAllRequest implements Serializable {
5252
* id used by BigQuery to detect duplicate insertion requests on a best-effort basis.
5353
*
5454
* <p>Example usage of creating a row to insert:
55-
* <pre> {@code
56-
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
57-
* Map<String, Object> recordContent = new HashMap<String, Object>();
58-
* recordContent.put("subfieldName1", "value");
59-
* recordContent.put("subfieldName2", repeatedFieldValue);
60-
* Map<String, Object> rowContent = new HashMap<String, Object>();
61-
* rowContent.put("fieldName1", true);
62-
* rowContent.put("fieldName2", recordContent);
63-
* RowToInsert row = new RowToInsert("rowId", rowContent);
55+
* <pre> {@code
56+
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
57+
* Map<String, Object> recordContent = new HashMap<String, Object>();
58+
* recordContent.put("subfieldName1", "value");
59+
* recordContent.put("subfieldName2", repeatedFieldValue);
60+
* Map<String, Object> rowContent = new HashMap<String, Object>();
61+
* rowContent.put("fieldName1", true);
62+
* rowContent.put("fieldName2", recordContent);
63+
* RowToInsert row = new RowToInsert("rowId", rowContent);
6464
* }</pre>
6565
*
6666
* @see <a href ="https://cloud.google.com/bigquery/streaming-data-into-bigquery#dataconsistency">
@@ -177,16 +177,16 @@ public Builder addRow(RowToInsert rowToInsert) {
177177
* Adds a row to be inserted with associated id.
178178
*
179179
* <p>Example usage of adding a row with associated id:
180-
* <pre> {@code
181-
* InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
182-
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
183-
* Map<String, Object> recordContent = new HashMap<String, Object>();
184-
* recordContent.put("subfieldName1", "value");
185-
* recordContent.put("subfieldName2", repeatedFieldValue);
186-
* Map<String, Object> rowContent = new HashMap<String, Object>();
187-
* rowContent.put("fieldName1", true);
188-
* rowContent.put("fieldName2", recordContent);
189-
* builder.addRow("rowId", rowContent);
180+
* <pre> {@code
181+
* InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
182+
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
183+
* Map<String, Object> recordContent = new HashMap<String, Object>();
184+
* recordContent.put("subfieldName1", "value");
185+
* recordContent.put("subfieldName2", repeatedFieldValue);
186+
* Map<String, Object> rowContent = new HashMap<String, Object>();
187+
* rowContent.put("fieldName1", true);
188+
* rowContent.put("fieldName2", recordContent);
189+
* builder.addRow("rowId", rowContent);
190190
* }</pre>
191191
*/
192192
public Builder addRow(String id, Map<String, Object> content) {
@@ -198,16 +198,16 @@ public Builder addRow(String id, Map<String, Object> content) {
198198
* Adds a row to be inserted without an associated id.
199199
*
200200
* <p>Example usage of adding a row without an associated id:
201-
* <pre> {@code
202-
* InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
203-
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
204-
* Map<String, Object> recordContent = new HashMap<String, Object>();
205-
* recordContent.put("subfieldName1", "value");
206-
* recordContent.put("subfieldName2", repeatedFieldValue);
207-
* Map<String, Object> rowContent = new HashMap<String, Object>();
208-
* rowContent.put("fieldName1", true);
209-
* rowContent.put("fieldName2", recordContent);
210-
* builder.addRow(rowContent);
201+
* <pre> {@code
202+
* InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
203+
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
204+
* Map<String, Object> recordContent = new HashMap<String, Object>();
205+
* recordContent.put("subfieldName1", "value");
206+
* recordContent.put("subfieldName2", repeatedFieldValue);
207+
* Map<String, Object> rowContent = new HashMap<String, Object>();
208+
* rowContent.put("fieldName1", true);
209+
* rowContent.put("fieldName2", recordContent);
210+
* builder.addRow(rowContent);
211211
* }</pre>
212212
*/
213213
public Builder addRow(Map<String, Object> content) {

gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/QueryRequest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@
3535
* {@link QueryResponse#jobCompleted()} returns {@code true}.
3636
*
3737
* <p>Example usage of a query request:
38-
* <pre> {@code
39-
* // Substitute "field", "table" and "dataset" with real field, table and dataset identifiers
40-
* QueryRequest request = QueryRequest.builder("SELECT field FROM table")
41-
* .defaultDataset(DatasetId.of("dataset"))
42-
* .maxWaitTime(60000L)
43-
* .maxResults(1000L)
44-
* .build();
45-
* QueryResponse response = bigquery.query(request);
46-
* while (!response.jobCompleted()) {
47-
* Thread.sleep(1000);
48-
* response = bigquery.getQueryResults(response.jobId());
49-
* }
50-
* List<BigQueryError> executionErrors = response.executionErrors();
51-
* // look for errors in executionErrors
52-
* QueryResult result = response.result();
53-
* Iterator<List<FieldValue>> rowIterator = result.iterateAll();
54-
* while(rowIterator.hasNext()) {
55-
* List<FieldValue> row = rowIterator.next();
56-
* // do something with row
57-
* }
38+
* <pre> {@code
39+
* // Substitute "field", "table" and "dataset" with real field, table and dataset identifiers
40+
* QueryRequest request = QueryRequest.builder("SELECT field FROM table")
41+
* .defaultDataset(DatasetId.of("dataset"))
42+
* .maxWaitTime(60000L)
43+
* .maxResults(1000L)
44+
* .build();
45+
* QueryResponse response = bigquery.query(request);
46+
* while (!response.jobCompleted()) {
47+
* Thread.sleep(1000);
48+
* response = bigquery.getQueryResults(response.jobId());
49+
* }
50+
* List<BigQueryError> executionErrors = response.executionErrors();
51+
* // look for errors in executionErrors
52+
* QueryResult result = response.result();
53+
* Iterator<List<FieldValue>> rowIterator = result.iterateAll();
54+
* while(rowIterator.hasNext()) {
55+
* List<FieldValue> row = rowIterator.next();
56+
* // do something with row
57+
* }
5858
* }</pre>
5959
*
6060
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/jobs/query">Query</a>

gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/QueryResponse.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@
2929
* Query Request ({@link BigQuery#query(QueryRequest)}).
3030
*
3131
* <p>Example usage of a query response:
32-
* <pre> {@code
33-
* QueryResponse response = bigquery.query(request);
34-
* while (!response.jobCompleted()) {
35-
* Thread.sleep(1000);
36-
* response = bigquery.getQueryResults(response.jobId());
37-
* }
38-
* List<BigQueryError> executionErrors = response.executionErrors();
39-
* // look for errors in executionErrors
40-
* QueryResult result = response.result();
41-
* Iterator<List<FieldValue>> rowIterator = result.iterateAll();
42-
* while(rowIterator.hasNext()) {
43-
* List<FieldValue> row = rowIterator.next();
44-
* // do something with row
45-
* }
32+
* <pre> {@code
33+
* QueryResponse response = bigquery.query(request);
34+
* while (!response.jobCompleted()) {
35+
* Thread.sleep(1000);
36+
* response = bigquery.getQueryResults(response.jobId());
37+
* }
38+
* List<BigQueryError> executionErrors = response.executionErrors();
39+
* // look for errors in executionErrors
40+
* QueryResult result = response.result();
41+
* Iterator<List<FieldValue>> rowIterator = result.iterateAll();
42+
* while(rowIterator.hasNext()) {
43+
* List<FieldValue> row = rowIterator.next();
44+
* // do something with row
45+
* }
4646
* }</pre>
4747
*
4848
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults">Get Query

gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/it/ITBigQueryTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,9 @@ public static void afterClass() throws ExecutionException, InterruptedException
197197
if (bigquery != null) {
198198
RemoteBigQueryHelper.forceDelete(bigquery, DATASET);
199199
}
200-
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 10, TimeUnit.SECONDS)) {
201-
if (LOG.isLoggable(Level.WARNING)) {
202-
LOG.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
203-
}
200+
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 10, TimeUnit.SECONDS)
201+
&& LOG.isLoggable(Level.WARNING)) {
202+
LOG.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
204203
}
205204
}
206205

gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ public Blob reload(BlobSourceOption... options) {
351351
* </p>
352352
*
353353
* <p>Example usage of replacing blob's metadata:
354-
* <pre> {@code blob.toBuilder().metadata(null).build().update();}
355-
* {@code blob.toBuilder().metadata(newMetadata).build().update();}
354+
* <pre> {@code blob.toBuilder().metadata(null).build().update();}
355+
* {@code blob.toBuilder().metadata(newMetadata).build().update();}
356356
* </pre>
357357
*
358358
* @param options update options

gcloud-java-storage/src/main/java/com/google/gcloud/storage/CopyWriter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ public class CopyWriter implements Restorable<CopyWriter> {
5757
* is {@code false} will block until all pending chunks are copied.
5858
*
5959
* <p>This method has the same effect of doing:
60-
* <pre> {@code while (!copyWriter.isDone()) {
61-
* copyWriter.copyChunk();
62-
* }}
60+
* <pre> {@code
61+
* while (!copyWriter.isDone()) {
62+
* copyWriter.copyChunk();
63+
* }}
6364
* </pre>
6465
*
6566
* @throws StorageException upon failure

gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,8 +1300,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
13001300
* can be done by setting the provided {@code blobInfo}'s metadata to {@code null}.
13011301
*
13021302
* <p>Example usage of replacing blob's metadata:
1303-
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
1304-
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
1303+
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
1304+
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
13051305
* </pre>
13061306
*
13071307
* @return the updated blob
@@ -1315,8 +1315,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
13151315
* can be done by setting the provided {@code blobInfo}'s metadata to {@code null}.
13161316
*
13171317
* <p>Example usage of replacing blob's metadata:
1318-
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
1319-
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
1318+
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
1319+
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
13201320
* </pre>
13211321
*
13221322
* @return the updated blob
@@ -1373,14 +1373,15 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
13731373
* might issue multiple RPC calls depending on blob's size.
13741374
*
13751375
* <p>Example usage of copy:
1376-
* <pre> {@code BlobInfo blob = service.copy(copyRequest).result();}
1376+
* <pre> {@code BlobInfo blob = service.copy(copyRequest).result();}
13771377
* </pre>
13781378
* To explicitly issue chunk copy requests use {@link CopyWriter#copyChunk()} instead:
1379-
* <pre> {@code CopyWriter copyWriter = service.copy(copyRequest);
1380-
* while (!copyWriter.isDone()) {
1381-
* copyWriter.copyChunk();
1382-
* }
1383-
* BlobInfo blob = copyWriter.result();
1379+
* <pre> {@code
1380+
* CopyWriter copyWriter = service.copy(copyRequest);
1381+
* while (!copyWriter.isDone()) {
1382+
* copyWriter.copyChunk();
1383+
* }
1384+
* BlobInfo blob = copyWriter.result();
13841385
* }
13851386
* </pre>
13861387
*
@@ -1462,8 +1463,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
14621463
* accessible blobs, but don't want to require users to explicitly log in.
14631464
*
14641465
* <p>Example usage of creating a signed URL that is valid for 2 weeks:
1465-
* <pre> {@code
1466-
* service.signUrl(BlobInfo.builder("bucket", "name").build(), 14, TimeUnit.DAYS);
1466+
* <pre> {@code
1467+
* service.signUrl(BlobInfo.builder("bucket", "name").build(), 14, TimeUnit.DAYS);
14671468
* }</pre>
14681469
*
14691470
* @param blobInfo the blob associated with the signed URL

gcloud-java-storage/src/test/java/com/google/gcloud/storage/it/ITStorageTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ public static void beforeClass() {
8888

8989
@AfterClass
9090
public static void afterClass() throws ExecutionException, InterruptedException {
91-
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS)) {
92-
if (log.isLoggable(Level.WARNING)) {
93-
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
94-
}
91+
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS)
92+
&& log.isLoggable(Level.WARNING)) {
93+
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
9594
}
9695
}
9796

@@ -442,15 +441,15 @@ public void testUpdateBlobFail() {
442441
@Test
443442
public void testDeleteNonExistingBlob() {
444443
String blobName = "test-delete-non-existing-blob";
445-
assertTrue(!storage.delete(BUCKET, blobName));
444+
assertFalse(storage.delete(BUCKET, blobName));
446445
}
447446

448447
@Test
449448
public void testDeleteBlobNonExistingGeneration() {
450449
String blobName = "test-delete-blob-non-existing-generation";
451450
BlobInfo blob = BlobInfo.builder(BUCKET, blobName).build();
452451
assertNotNull(storage.create(blob));
453-
assertTrue(!storage.delete(BlobId.of(BUCKET, blobName, -1L)));
452+
assertFalse(storage.delete(BlobId.of(BUCKET, blobName, -1L)));
454453
}
455454

456455
@Test
@@ -966,7 +965,7 @@ public void testDeleteBlobsFail() {
966965
assertNotNull(storage.create(sourceBlob1));
967966
List<Boolean> deleteStatus = storage.delete(sourceBlob1.blobId(), sourceBlob2.blobId());
968967
assertTrue(deleteStatus.get(0));
969-
assertTrue(!deleteStatus.get(1));
968+
assertFalse(deleteStatus.get(1));
970969
}
971970

972971
@Test

0 commit comments

Comments
 (0)