Skip to content

Commit e8550f5

Browse files
committed
---
yaml --- r: 889 b: refs/heads/master c: abb421e h: refs/heads/master i: 887: bb8aae6 v: v3
1 parent 04beb4c commit e8550f5

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
@@ -1,4 +1,4 @@
11
---
2-
refs/heads/master: 90dd0709ee844da91e19dca2adce75ff219fa29e
2+
refs/heads/master: abb421e7fbc259a411d94f169f6d3f8c2a5d038c
33
refs/heads/travis: 0fa997e2fc9c6b61b2d91e6d163655aae67d44b6
44
refs/heads/gh-pages: 5a10432ecc75f29812e33a8236c900379509fe99

trunk/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)