GeezerVison is showing github.com — NPE From some Storage methods · Issue #174 · googleapis/google-cloud-java
NPE From some Storage methods #174Labels 🚨 criticalP0 critical issue. Requires immediate fixapi: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DescriptionFor example the following calls when listing a bucket that is empty or getting an item from a bucket that exists but the item does not:
storage.list( bucketName )
storage.get( bucketName, itemName )
The NPE is generated from the Preconditions class called via transform() in the Iterables class:
public static <T> T checkNotNull(T reference) {
if(reference == null) {
throw new NullPointerException();
} else {
return reference;
}
}
It would be nicer to return a null to the caller perhaps. wdyt? Activitymziccard commented on Sep 23, 2015 Hi @simon-temple, thanks for catching this!
I was able to reproduce the error with storage.list("non-existing-bucket") while storage.get("existing-bucket", "non-existing-blob") returns null as expected. Could you double check this please? mziccard commented on Sep 23, 2015 This problem also occurs when listing buckets if none exists (storage.list()). simon-temple commented on Sep 24, 2015 Here is a stack trace of an attempt to get() a none existent blob from an existing bucket:
Caused by: java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210)
at com.google.gcloud.storage.BlobInfo$Builder.name(BlobInfo.java:125)
at com.google.gcloud.storage.BlobInfo.builder(BlobInfo.java:390)
at com.google.gcloud.storage.BlobInfo.of(BlobInfo.java:382)
at com.google.gcloud.storage.StorageImpl.get(StorageImpl.java:149)
simon-temple commented on Sep 24, 2015 Could you also check:
bucketInfo = storage.get( "none-existent-bucket" );
I believe this will also throw a NPE. mziccard commented on Sep 24, 2015 Thanks for checking. The stack trace you posted looks more like you are doing something like
get("existing-bucket", null)
Could you check that the blob name you are passing is actually not null? simon-temple commented on Sep 24, 2015 You are correct. My bad...sorry!
I am calling get("existing-bucket", null) and I shouldn't; but that's my problem :-)
Thanks for your help. mziccard commented on Sep 24, 2015 Nothing to be sorry about. The other problems you spotted when listing an empty bucket or listing buckets when none exists are our fault so let me thank you for catching them :)
I'll keep this issue open until I fix them (should be real soon). simon-temple commented on Sep 28, 2015 Thank you for the quick turnaround. Does this project have a SNAPSHOT repo? I'd like to run some tests with the latest/fixed version if possible. Maybe I need to clone the project and rebuild locally?
Any idea when the next release will be available? mziccard commented on Sep 28, 2015 Yes, we are publishing snapshot to Sonatype snapshots repository:
https://oss.sonatype.org/content/repositories/snapshots/
Current snapshot is 0.0.8-SNAPSHOT. Be aware that PR #183 is not merged yet so it's not part of the snapshot (i.e. you'll still have this issue). I hope we'll manage to merge it by the end of the day.
@aozarov should have more info on the plans for next release. aozarov commented on Sep 28, 2015 As you can see Storage is still work in progress (and that is why it is not yet mentioned in list of supported services in the README.md).
Snapshots should be pushed automatically (triggered by Travis), so once this change is pushed it should not take long before it appears here.
MetadataMetadata🚨 criticalP0 critical issue. Requires immediate fixapi: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DevelopmentNo branches or pull requestsIssue actions
|