-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
I'm trying to delete in a batch and got IllegalStateException. I think I'm doing something wrong but can't tell what it is with the doc I can find. Thank you!
Java version: 11
storage version(s): google-cloud-storage 1.103.1
Code example
Iterable<Blob> blobs =
gcs.list(bucketName, Storage.BlobListOption.prefix(objectNamePrefix)).iterateAll();
try {
StorageBatch batch = gcs.batch();
for (Blob blob : blobs) {
batch
.delete(blob.getBlobId())
.notify(
new BatchResult.Callback<Boolean, StorageException>() {
public void success(Boolean result) {}
public void error(StorageException exception) {
exception.printStackTrace();
}
});
}
batch.submit();
} catch (UnsupportedOperationException ex) {
}
Stack trace
Caused by: java.lang.IllegalStateException: null
at com.google.common.base.Preconditions.checkState(Preconditions.java:492) ~[guava-28.2-jre.jar!/:na]
at com.google.api.client.util.Preconditions.checkState(Preconditions.java:79) ~[google-http-client-1.34.0.jar!/:1.34.0]
at com.google.api.client.googleapis.batch.BatchRequest.execute(BatchRequest.java:233) ~[google-api-client-1.30.7.jar!/:1.30.7]
at com.google.cloud.storage.spi.v1.HttpStorageRpc$DefaultRpcBatch.submit(HttpStorageRpc.java:201) ~[google-cloud-storage-1.103.1.jar!/:1.103.1]
at com.google.cloud.storage.StorageBatch.submit(StorageBatch.java:149) ~[google-cloud-storage-1.103.1.jar!/:1.103.1]
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.