-
Notifications
You must be signed in to change notification settings - Fork 85
Closed
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- google cloud storage
- OS type and version: Ubuntu 18.04.4, running in docker container on k8s.
- Java version:
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode) - storage version(s):
google-cloud-storage-1.113.9.jar
google-cloud-core-1.94.0.jar
google-cloud-core-http-1.94.0.jar
Steps to reproduce
- Upload content per code below
Code example
BlobId blobId = BlobId.of(bucketName, key);
String md5;
try (InputStream inputStream = getInputStream()) {
md5 = Base64.encodeBase64String(DigestUtils.md5(inputStream));
}
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType(getContentType())
.setContentDisposition(String.format("attachment; filename=%s", getDownloadName()))
.setMd5(md5)
.build();
storage.createFrom(blobInfo, getInputStream(), Storage.BlobWriteOption.md5Match());Stack trace
Caused by: java.lang.NullPointerException
at com.google.cloud.storage.BlobId.fromPb(BlobId.java:119)
at com.google.cloud.storage.BlobInfo.fromPb(BlobInfo.java:1160)
at com.google.cloud.storage.Blob.fromPb(Blob.java:958)
at com.google.cloud.storage.StorageImpl.createFrom(StorageImpl.java:267)
at com.google.cloud.storage.StorageImpl.createFrom(StorageImpl.java:253)
at org.ambraproject.rhino.service.impl.GCSObjectStorageServiceImpl.storeFile(GCSObjectStorageServiceImpl.java:72)
at org.ambraproject.rhino.service.impl.GCSObjectStorageServiceImpl.lambda$null$0(GCSObjectStorageServiceImpl.java:78)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
This is an intermittent issue - I’ve only seen it once, as far as I know. I can’t see how the NPE could be coming from our code. I can’t seem to find any similar issue in the issues list or online.
Thanks for any help you can provide!
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/java-storage API.Issues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.