Skip to content

feat(java): add deleteFolderRecursive sample#13428

Draft
nidhiii-27 wants to merge 3 commits into
mainfrom
feature/delete-folder-recursive
Draft

feat(java): add deleteFolderRecursive sample#13428
nidhiii-27 wants to merge 3 commits into
mainfrom
feature/delete-folder-recursive

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor

This adds a sample demonstrating how to recursively delete a folder in a hierarchical namespace bucket.

Fixes: b/521168740

This adds a sample demonstrating how to recursively delete a folder in a hierarchical namespace bucket.

Fixes: b/521168740

[Generated-by: AI]
@nidhiii-27 nidhiii-27 requested review from a team as code owners June 11, 2026 10:55
@snippet-bot

snippet-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new code snippet DeleteFolderRecursive.java to demonstrate recursive folder deletion using StorageControlClient, along with a corresponding integration test in FoldersTest.java. The feedback highlights two main improvements: simplifying the redundant throws clause in the deleteFolderRecursive method signature, and removing the unused gen1 variable assignment in the test method.

Comment on lines +28 to +29
public static void deleteFolderRecursive(String bucketName, String folderName)
throws ExecutionException, InterruptedException, Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The throws clause is redundant because Exception is a superclass of ExecutionException and InterruptedException. Declaring them together is unnecessary. We can simplify this by throwing only Exception.

Suggested change
public static void deleteFolderRecursive(String bucketName, String folderName)
throws ExecutionException, InterruptedException, Exception {
public static void deleteFolderRecursive(String bucketName, String folderName)
throws Exception {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +145 to +149
Folder gen1 =
storageControl.createFolder(
BucketName.of("_", bucket.getName()),
Folder.getDefaultInstance(),
folderName.getFolder());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The variable gen1 is declared but never used. You can invoke createFolder directly without assigning its return value to an unused variable.

    storageControl.createFolder(
        BucketName.of("_", bucket.getName()),
        Folder.getDefaultInstance(),
        folderName.getFolder());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@nidhiii-27 nidhiii-27 marked this pull request as draft June 11, 2026 11:00
@nidhiii-27 nidhiii-27 added the storage-sample-architect Generated by storage-sample-architect skill label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated storage-sample-architect Generated by storage-sample-architect skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant