Skip to content

Commit 6fb0b13

Browse files
committed
---
yaml --- r: 6539 b: refs/heads/tswast-patch-1 c: bfe8924 h: refs/heads/master i: 6537: 888060e 6535: beddf5a
1 parent afbe9b2 commit 6fb0b13

4 files changed

Lines changed: 15 additions & 5 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: 65373146e8cd827011631eb111ad4a5b52f5c2a5
60+
refs/heads/tswast-patch-1: bfe892428127615e2d75bcc51378c125e76ab637
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,11 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
14081408
/**
14091409
* Return a channel for reading the blob's content. The blob's latest generation is read. If the
14101410
* blob changes while reading (i.e. {@link BlobInfo#etag()} changes), subsequent calls to
1411-
* {@link BlobReadChannel#read(ByteBuffer)} may throw {@link StorageException}.
1411+
* {@code blobReadChannel.read(ByteBuffer)} may throw {@link StorageException}.
1412+
*
1413+
* <p>The {@link BlobSourceOption#generationMatch(long)} option can be provided to ensure that
1414+
* {@code blobReadChannel.read(ByteBuffer)} calls will throw {@link StorageException} if blob`s
1415+
* generation differs from the expected one.
14121416
*
14131417
* @throws StorageException upon failure
14141418
*/
@@ -1418,9 +1422,14 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
14181422
* Return a channel for reading the blob's content. If {@code blob.generation()} is set
14191423
* data corresponding to that generation is read. If {@code blob.generation()} is {@code null}
14201424
* the blob's latest generation is read. If the blob changes while reading (i.e.
1421-
* {@link BlobInfo#etag()} changes), subsequent calls to {@link BlobReadChannel#read(ByteBuffer)}
1425+
* {@link BlobInfo#etag()} changes), subsequent calls to {@code blobReadChannel.read(ByteBuffer)}
14221426
* may throw {@link StorageException}.
14231427
*
1428+
* <p>The {@link BlobSourceOption#generationMatch()} and
1429+
* {@link BlobSourceOption#generationMatch(long)} options can be used to ensure that
1430+
* {@code blobReadChannel.read(ByteBuffer)} calls will throw {@link StorageException} if the
1431+
* blob`s generation differs from the expected one.
1432+
*
14241433
* @throws StorageException upon failure
14251434
*/
14261435
BlobReadChannel reader(BlobId blob, BlobSourceOption... options);

branches/tswast-patch-1/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelImplTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ public void testReadGenerationChanged() throws IOException {
188188
StringBuilder messageBuilder = new StringBuilder();
189189
messageBuilder.append("Blob ").append(blobId).append(" was updated while reading");
190190
assertEquals(messageBuilder.toString(), ex.getMessage());
191-
// expected
192191
}
193192
}
194193

branches/tswast-patch-1/gcloud-java-storage/src/test/java/com/google/gcloud/storage/ITStorageTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,9 @@ public void testReadChannelFailUpdatedGeneration() throws IOException {
759759
reader.read(readBytes);
760760
fail("StorageException was expected");
761761
} catch(StorageException ex) {
762-
// expected
762+
StringBuilder messageBuilder = new StringBuilder();
763+
messageBuilder.append("Blob ").append(blob.blobId()).append(" was updated while reading");
764+
assertEquals(messageBuilder.toString(), ex.getMessage());
763765
}
764766
assertTrue(storage.delete(BUCKET, blobName));
765767
}

0 commit comments

Comments
 (0)