Skip to content

NPE when generationNotMatch fails #731

Closed
@dimo414

Description

The following:

bucket.create("file", new byte[0], "text/plain");
Blob blob = bucket.get("file");
bucket.storage().create(blob, new byte[0], BlobTargetOption.generationNotMatch());

Causes a:

com.google.gcloud.storage.StorageException: java.lang.NullPointerException
    at com.google.gcloud.storage.StorageException.translateAndThrow(StorageException.java:74)
    at com.google.gcloud.storage.StorageImpl.create(StorageImpl.java:150)
    at com.google.gcloud.storage.StorageImpl.create(StorageImpl.java:129)
    ...

The translateAndThrow() call suppresses the underlying stack trace, but this shouldn't trigger an NPE. I do expect it to fail, but it should fail with a meaningful error message.

Metadata

Assignees

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