Skip to content

Commit 6b61328

Browse files
committed
---
yaml --- r: 1961 b: refs/heads/pubsub-alpha c: bfe8924 h: refs/heads/master i: 1959: 86a1429
1 parent 8c832bb commit 6b61328

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
@@ -3,7 +3,7 @@ refs/heads/master: 689bbb466df4b2d5d2483d6edb8ac5c7c7f7c6fa
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
6-
refs/heads/pubsub-alpha: 65373146e8cd827011631eb111ad4a5b52f5c2a5
6+
refs/heads/pubsub-alpha: bfe892428127615e2d75bcc51378c125e76ab637
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
88
refs/heads/update-datastore: 482954f2c5055231e5b3122ea91d2ba00ce8187c
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

branches/pubsub-alpha/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/pubsub-alpha/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/pubsub-alpha/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)