feat(java): add deleteFolderRecursive sample#13428
Conversation
This adds a sample demonstrating how to recursively delete a folder in a hierarchical namespace bucket. Fixes: b/521168740 [Generated-by: AI]
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
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.
| public static void deleteFolderRecursive(String bucketName, String folderName) | ||
| throws ExecutionException, InterruptedException, Exception { |
There was a problem hiding this comment.
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.
| public static void deleteFolderRecursive(String bucketName, String folderName) | |
| throws ExecutionException, InterruptedException, Exception { | |
| public static void deleteFolderRecursive(String bucketName, String folderName) | |
| throws Exception { |
| Folder gen1 = | ||
| storageControl.createFolder( | ||
| BucketName.of("_", bucket.getName()), | ||
| Folder.getDefaultInstance(), | ||
| folderName.getFolder()); |
There was a problem hiding this comment.
This adds a sample demonstrating how to recursively delete a folder in a hierarchical namespace bucket.
Fixes: b/521168740