GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [NIO] Files.walkFileTree doesn't visit files · Issue #1519 · googleapis/google-cloud-java

[NIO] Files.walkFileTree doesn't visit files #1519

New issue
Copy link
New issue
Copy link
Closed
Closed
[NIO] Files.walkFileTree doesn't visit files#1519
Copy link
Assignees
yoshi-automation

Description

@tomwhite
tomwhite
opened on Jan 10, 2017
Issue body actions

There are a couple of problems running this code for deleting a directory recursively: https://github.com/HadoopGenomics/Hadoop-BAM/blob/master/src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java#L63-L74

  1. The code for visitFile is never called.
  2. Files.delete(dir) fails with "Can't perform I/O on pseudo-directories (trailing slash)"

It would be good to add tests for Files.walkFileTree (and Files.walk) to the unit tests.

Activity

  1. garrettjonesgoogle
    added
    contrib
    on Jan 11, 2017
  2. tomwhite commented on Feb 20, 2017

    @tomwhite
    tomwhite
    on Feb 20, 2017
    Author
    More actions

    #1630 addresses some of this, but there's still a remaining issue.

    The following prints the files in a directory:

    Path p = CloudStorageFileSystem.forBucket("bucket").getPath("dir/");
    Files.list(p).forEach(System.out::println);

    However, this doesn't work:

    Path p = Paths.get(URI.create("gs://bucket/dir/"))
    Files.list(p).forEach(System.out::println);

    The problem is to do with the underlying path not having a the leading slash removed in the second case. This seems to fix the problem:

    --- a/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java
    +++ b/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java
    @@ -608,7 +608,7 @@ public final class CloudStorageFileSystemProvider extends FileSystemProvider {
         final CloudStoragePath cloudPath = CloudStorageUtil.checkPath(dir);
         checkNotNull(filter);
         initStorage();
    -    String prefix = cloudPath.toString();
    +    String prefix = cloudPath.toRealPath().toString();
         final Iterator<Blob> blobIterator = storage.list(cloudPath.bucket(),
             Storage.BlobListOption.prefix(prefix), Storage.BlobListOption.currentDirectory(),
             Storage.BlobListOption.fields()).iterateAll();
    
  3. jean-philippe-martin commented on Feb 22, 2017

    @jean-philippe-martin
    jean-philippe-martin
    on Feb 22, 2017
    More actions

    Thank you @tomwhite for the clear bug report and fix! I put together PR #1644 with the fix.

  4. jean-philippe-martin commented on Apr 17, 2017

    @jean-philippe-martin
    jean-philippe-martin
    on Apr 17, 2017
    More actions

    #1644 was merged in so this bug should be fixed now.

  5. jean-philippe-martin commented on May 15, 2017

    @jean-philippe-martin
    jean-philippe-martin
    on May 15, 2017
    More actions

    Whoever has the permissions to do it, please close the bug. @tomwhite please reopen if the fix doesn't work for you.

  6. tcoffee-google
    closed this as completedon Jun 12, 2017
  7. jean-philippe-martin commented on Jun 12, 2017

    @jean-philippe-martin
    jean-philippe-martin
    on Jun 12, 2017
    More actions

    Thank you!

  8. JustinBeckwith
    assigned
    yoshi-automation
    on Feb 1, 2021
  9. github-actions
    added a commit that references this issue on Oct 4, 2022

    chore(main): release 2.3.15 (#1519)

    a87b8fc
  10. meltsufin
    added a commit that references this issue on Dec 22, 2025

    chore(main): release 3.15.17-SNAPSHOT (#1519)

    22df0fc
  11. chingor13
    added a commit that references this issue on Jan 6, 2026

    deps: update dependency com.google.cloud:sdk-platform-java-config to …

    e3caf33
  12. chingor13
    added a commit that references this issue on Jan 22, 2026

    chore: remove datastore native image sample in favor of sample hosted…

    f209ad4
  13. chingor13
    added a commit that references this issue on Feb 24, 2026

    chore(deps): update dependency org.apache.maven.plugins:maven-javadoc…

    132a71a
  14. suztomo
    added a commit that references this issue on Mar 11, 2026

    chore(main): release 3.15.17-SNAPSHOT (googleapis#1519)

    554170e
  15. chingor13
    added a commit that references this issue on Mar 12, 2026

    chore(deps): update dependency org.apache.maven.plugins:maven-javadoc…

    c36e24b
  16. lqiu96
    added a commit that references this issue on Mar 20, 2026

    deps: update dependency com.google.cloud:sdk-platform-java-config to …

    4f107cc
  17. suztomo
    added a commit that references this issue on Mar 23, 2026

    test(deps): update dependency com.google.truth:truth to v1.4.2 (googl…

    a656115
  18. suztomo
    added 2 commits that reference this issue on Mar 30, 2026

    deps: update dependency com.google.guava:guava to v33.4.0-android (#1519

    c1a0df4

    chore(main): release 0.127.29 (#1518)

    54f5c50
  19. lqiu96
    added 2 commits that reference this issue on Apr 1, 2026

    deps: update dependency com.google.guava:guava to v33.4.0-android (#1519

    633653a

    chore(main): release 0.127.29 (#1518)

    5f197ec
  20. benjaminp
    added a commit that references this issue on Jul 13, 2026

    deps: update dependency com.google.cloud:google-cloud-monitoring-bom … (

    927d57b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @yoshi-automation
    yoshi-automation

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.