Skip to content

Commit e09ea4f

Browse files
---
yaml --- r: 5285 b: refs/heads/master c: 824ad77 h: refs/heads/master i: 5283: 66e362a
1 parent 0b616ea commit e09ea4f

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: d1e1c85c93b0c53a66b60687e5accc54d416aac5
2+
refs/heads/master: 824ad7753fb24ba92035bf8a7874ea9ea8aa5d87
33
refs/heads/travis: dae77e558b884bc1b165155482d76c8e40b0fca4
44
refs/heads/gh-pages: 229631582f8957646f81e92ae5a326504f48ee5b
55
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

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

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