Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

StorageBatch get IllegalStateException #694

Copy link
Copy link

Description

@lwshuo
Issue body actions

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]
Reactions are currently unavailable

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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.