Skip to content

Commit 0ef71d4

Browse files
committed
---
yaml --- r: 6157 b: refs/heads/tswast-patch-1 c: b5b43d9 h: refs/heads/master i: 6155: 44dfd25
1 parent ce5c966 commit 0ef71d4

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: 48458d345e33459aa7d477c820f7a83923cddc8a
60+
refs/heads/tswast-patch-1: b5b43d9bd0cbf68e6ae38b282e32dc679fe8cc36
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.google.api.services.storage.model.StorageObject;
3535
import com.google.common.base.Function;
3636
import com.google.common.base.Functions;
37+
import com.google.common.collect.ImmutableList;
3738
import com.google.common.collect.ImmutableMap;
3839
import com.google.common.collect.Iterables;
3940
import com.google.common.collect.Lists;
@@ -234,14 +235,16 @@ public Tuple<String, Iterable<com.google.api.services.storage.model.Bucket>> cal
234235
}
235236
}, serviceOptions.retryParams(), EXCEPTION_HANDLER);
236237
String cursor = result.x();
237-
return new BaseListResult<>(new BucketPageFetcher(serviceOptions, cursor, optionsMap), cursor,
238-
Iterables.transform(result.y(),
238+
Iterable<BucketInfo> buckets =
239+
result.y() == null ? ImmutableList.<BucketInfo>of() : Iterables.transform(result.y(),
239240
new Function<com.google.api.services.storage.model.Bucket, BucketInfo>() {
240241
@Override
241242
public BucketInfo apply(com.google.api.services.storage.model.Bucket bucketPb) {
242243
return BucketInfo.fromPb(bucketPb);
243244
}
244-
}));
245+
});
246+
return new BaseListResult<>(new BucketPageFetcher(serviceOptions, cursor, optionsMap), cursor,
247+
buckets);
245248
}
246249

247250
@Override
@@ -259,14 +262,17 @@ public Tuple<String, Iterable<StorageObject>> call() {
259262
}
260263
}, serviceOptions.retryParams(), EXCEPTION_HANDLER);
261264
String cursor = result.x();
262-
return new BaseListResult<>(new BlobPageFetcher(bucket, serviceOptions, cursor, optionsMap), cursor,
263-
Iterables.transform(result.y(),
265+
Iterable<BlobInfo> blobs =
266+
result.y() == null ? ImmutableList.<BlobInfo>of() : Iterables.transform(result.y(),
264267
new Function<StorageObject, BlobInfo>() {
265268
@Override
266269
public BlobInfo apply(StorageObject storageObject) {
267270
return BlobInfo.fromPb(storageObject);
268271
}
269-
}));
272+
});
273+
return new BaseListResult<>(new BlobPageFetcher(bucket, serviceOptions, cursor, optionsMap),
274+
cursor,
275+
blobs);
270276
}
271277

272278
@Override
@@ -434,7 +440,7 @@ public BlobReadChannel reader(String bucket, String blob, BlobSourceOption... op
434440
return new BlobReadChannelImpl(options(), BlobInfo.of(bucket, blob), optionsMap);
435441
}
436442

437-
@Override
443+
@Override
438444
public BlobWriteChannel writer(BlobInfo blobInfo, BlobTargetOption... options) {
439445
final Map<StorageRpc.Option, ?> optionsMap = optionMap(blobInfo, options);
440446
return new BlobWriterChannelImpl(options(), blobInfo, optionsMap);
@@ -461,12 +467,12 @@ public URL signUrl(BlobInfo blobInfo, long expiration, SignUrlOption... options)
461467
stBuilder.append(HttpMethod.GET);
462468
}
463469
stBuilder.append('\n');
464-
if (firstNonNull((Boolean) optionMap.get(SignUrlOption.Option.MD5) , false)) {
470+
if (firstNonNull((Boolean) optionMap.get(SignUrlOption.Option.MD5), false)) {
465471
checkArgument(blobInfo.md5() != null, "Blob is missing a value for md5");
466472
stBuilder.append(blobInfo.md5());
467473
}
468474
stBuilder.append('\n');
469-
if (firstNonNull((Boolean) optionMap.get(SignUrlOption.Option.CONTENT_TYPE) , false)) {
475+
if (firstNonNull((Boolean) optionMap.get(SignUrlOption.Option.CONTENT_TYPE), false)) {
470476
checkArgument(blobInfo.contentType() != null, "Blob is missing a value for content-type");
471477
stBuilder.append(blobInfo.contentType());
472478
}

0 commit comments

Comments
 (0)