Skip to content

Commit 15e7a4e

Browse files
---
yaml --- r: 7733 b: refs/heads/tswast-patch-1 c: 824ad77 h: refs/heads/master i: 7731: c5aa45d
1 parent 349995e commit 15e7a4e

3 files changed

Lines changed: 14 additions & 6 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: d1e1c85c93b0c53a66b60687e5accc54d416aac5
60+
refs/heads/tswast-patch-1: 824ad7753fb24ba92035bf8a7874ea9ea8aa5d87
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,15 @@ public CloudStorageFileSystem getFileSystem(URI uri) {
170170
}
171171

172172
/**
173-
* Returns Cloud Storage file system, provided a URI with no path, e.g. {@code gs://bucket}.
173+
* Returns Cloud Storage file system, provided a URI, e.g. {@code gs://bucket}.
174+
* The URI can include a path component (that will be ignored).
174175
*
175176
* @param uri bucket and current working directory, e.g. {@code gs://bucket}
176177
* @param env map of configuration options, whose keys correspond to the method names of
177178
* {@link CloudStorageConfiguration.Builder}. However you are not allowed to set the working
178179
* directory, as that should be provided in the {@code uri}
179-
* @throws IllegalArgumentException if {@code uri} specifies a user, query, fragment, or scheme is
180-
* not {@value CloudStorageFileSystem#URI_SCHEME}
180+
* @throws IllegalArgumentException if {@code uri} specifies a port, user, query, or fragment, or
181+
* if scheme is not {@value CloudStorageFileSystem#URI_SCHEME}
181182
*/
182183
@Override
183184
public CloudStorageFileSystem newFileSystem(URI uri, Map<String, ?> env) {
@@ -191,11 +192,10 @@ public CloudStorageFileSystem newFileSystem(URI uri, Map<String, ?> env) {
191192
CloudStorageFileSystem.URI_SCHEME, uri);
192193
checkArgument(
193194
uri.getPort() == -1
194-
&& isNullOrEmpty(uri.getPath())
195195
&& isNullOrEmpty(uri.getQuery())
196196
&& isNullOrEmpty(uri.getFragment())
197197
&& isNullOrEmpty(uri.getUserInfo()),
198-
"GCS FileSystem URIs mustn't have: port, userinfo, path, query, or fragment: %s",
198+
"GCS FileSystem URIs mustn't have: port, userinfo, query, or fragment: %s",
199199
uri);
200200
CloudStorageUtil.checkBucket(uri.getHost());
201201
initStorage();

branches/tswast-patch-1/google-cloud-contrib/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProviderTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
import java.nio.file.OpenOption;
5555
import java.nio.file.Path;
5656
import java.nio.file.Paths;
57+
import java.util.HashMap;
5758
import java.util.List;
59+
import java.util.Map;
5860

5961
/**
6062
* Unit tests for {@link CloudStorageFileSystemProvider}.
@@ -644,6 +646,12 @@ public void testProviderEquals() {
644646
assertThat(path1.getFileSystem().provider()).isNotEqualTo(path3.getFileSystem().provider());
645647
}
646648

649+
@Test
650+
public void testNewFileSystem() throws IOException {
651+
Map<String,String> env = new HashMap<>();
652+
FileSystems.newFileSystem(URI.create("gs://bucket/path/to/file"), env);
653+
}
654+
647655
private static CloudStorageConfiguration permitEmptyPathComponents(boolean value) {
648656
return CloudStorageConfiguration.builder().permitEmptyPathComponents(value).build();
649657
}

0 commit comments

Comments
 (0)