Skip to content

Commit 6f46d92

Browse files
committed
---
yaml --- r: 4543 b: refs/heads/logging-alpha c: 28f4a18 h: refs/heads/master i: 4541: e4be59a 4539: f6e4c49 4535: 4c534c6 4527: 377f3f0 4511: 2f3d867 4479: 4d70bab
1 parent ef9c0a4 commit 6f46d92

5 files changed

Lines changed: 14 additions & 11 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ refs/heads/compute-alpha: 969cba2627f1d53d352cc4a5ffe0879dacf65e6c
1212
refs/heads/dns-alpha: 2f90e7e338349287ace33375896907af0f032ca1
1313
refs/heads/dns-alpha-batch: 17442b07867021b85d0452f5f3eda29a3413288f
1414
refs/heads/gcs-nio: 283aeaf15efdcf3621eb6859f05e55ad7764375d
15-
refs/heads/logging-alpha: 332f99057b098429f95ce09ec0e6cfd40f4380d5
15+
refs/heads/logging-alpha: 28f4a18ae41148f82ffe11bbb311f92f50da180f
1616
refs/tags/v0.1.0: a615317f7424ed58621b1f65d5c4d8cbbe8a6ed8
1717
refs/tags/v0.1.1: 7a7f6985fe465e9dd6a075af55493f42b4933be0
1818
refs/tags/v0.1.2: 3eb3fe866ba22487686048f45d927b8c8638ea3f

branches/logging-alpha/gcloud-java-core/src/main/java/com/google/gcloud/BaseWriteChannel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.IOException;
2222
import java.io.Serializable;
2323
import java.nio.ByteBuffer;
24+
import java.nio.channels.ClosedChannelException;
2425
import java.util.Arrays;
2526
import java.util.Objects;
2627

@@ -114,9 +115,9 @@ private void flush() {
114115
}
115116
}
116117

117-
private void validateOpen() throws IOException {
118+
private void validateOpen() throws ClosedChannelException {
118119
if (!isOpen) {
119-
throw new IOException("stream is closed");
120+
throw new ClosedChannelException();
120121
}
121122
}
122123

branches/logging-alpha/gcloud-java-core/src/test/java/com/google/gcloud/BaseWriteChannelTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.io.IOException;
3333
import java.io.Serializable;
3434
import java.nio.ByteBuffer;
35+
import java.nio.channels.ClosedChannelException;
3536
import java.util.Arrays;
3637
import java.util.Random;
3738

@@ -102,8 +103,7 @@ public void testClose() throws IOException {
102103
@Test
103104
public void testValidateOpen() throws IOException {
104105
channel.close();
105-
thrown.expect(IOException.class);
106-
thrown.expectMessage("stream is closed");
106+
thrown.expect(ClosedChannelException.class);
107107
channel.write(ByteBuffer.allocate(42));
108108
}
109109

branches/logging-alpha/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobReadChannel.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.io.IOException;
3030
import java.io.Serializable;
3131
import java.nio.ByteBuffer;
32+
import java.nio.channels.ClosedChannelException;
3233
import java.util.Map;
3334
import java.util.Objects;
3435
import java.util.concurrent.Callable;
@@ -55,7 +56,7 @@ class BlobReadChannel implements ReadChannel {
5556
private byte[] buffer;
5657

5758
BlobReadChannel(StorageOptions serviceOptions, BlobId blob,
58-
Map<StorageRpc.Option, ?> requestOptions) {
59+
Map<StorageRpc.Option, ?> requestOptions) {
5960
this.serviceOptions = serviceOptions;
6061
this.blob = blob;
6162
this.requestOptions = requestOptions;
@@ -91,9 +92,9 @@ public void close() {
9192
}
9293
}
9394

94-
private void validateOpen() throws IOException {
95+
private void validateOpen() throws ClosedChannelException {
9596
if (!isOpen) {
96-
throw new IOException("stream is closed");
97+
throw new ClosedChannelException();
9798
}
9899
}
99100

branches/logging-alpha/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
import java.io.IOException;
4141
import java.nio.ByteBuffer;
42+
import java.nio.channels.ClosedChannelException;
4243
import java.util.Arrays;
4344
import java.util.Map;
4445
import java.util.Random;
@@ -156,15 +157,15 @@ public void testClose() {
156157
}
157158

158159
@Test
159-
public void testReadClosed() {
160+
public void testReadClosed() throws IOException {
160161
replay(storageRpcMock);
161162
reader = new BlobReadChannel(options, BLOB_ID, EMPTY_RPC_OPTIONS);
162163
reader.close();
163164
try {
164165
ByteBuffer readBuffer = ByteBuffer.allocate(DEFAULT_CHUNK_SIZE);
165166
reader.read(readBuffer);
166-
fail("Expected BlobReadChannel read to throw IOException");
167-
} catch (IOException ex) {
167+
fail("Expected BlobReadChannel read to throw ClosedChannelException");
168+
} catch (ClosedChannelException ex) {
168169
// expected
169170
}
170171
}

0 commit comments

Comments
 (0)