[BUG] getByResourceGroup throws an NPE when the resource is a Gallery, GalleryImage or GalleryImageVersion #15097
Closed
3 tasks done
Labels
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
Compute
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Mgmt
This issue is related to a management-plane library.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
getByResourceGroup throws an NPE when the resource is a Gallery, GalleryImage or GalleryImageVersion which it shouldn't. I am just using this function to check whether the resource exists.
Exception or Stack Trace
java.lang.NullPointerException: null
at com.microsoft.azure.management.compute.implementation.GalleryImageImpl.(GalleryImageImpl.java:56)
at com.microsoft.azure.management.compute.implementation.GalleryImagesImpl.wrapModel(GalleryImagesImpl.java:42)
at com.microsoft.azure.management.compute.implementation.GalleryImagesImpl.access$000(GalleryImagesImpl.java:24)
at com.microsoft.azure.management.compute.implementation.GalleryImagesImpl$4.call(GalleryImagesImpl.java:84)
at com.microsoft.azure.management.compute.implementation.GalleryImagesImpl$4.call(GalleryImagesImpl.java:81)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:511)
at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:466)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:244)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at retrofit2.adapter.rxjava.CallArbiter.deliverResponse(CallArbiter.java:120)
at retrofit2.adapter.rxjava.CallArbiter.emitResponse(CallArbiter.java:102)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:46)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.DeferredScalarSubscriber.subscribeTo(DeferredScalarSubscriber.java:153)
at rx.internal.operators.OnSubscribeTakeLastOne.call(OnSubscribeTakeLastOne.java:32)
at rx.internal.operators.OnSubscribeTakeLastOne.call(OnSubscribeTakeLastOne.java:22)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.subscribe(Observable.java:10423)
at rx.Observable.subscribe(Observable.java:10390)
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:443)
at rx.observables.BlockingObservable.last(BlockingObservable.java:226)
at com.microsoft.azure.management.compute.implementation.GalleryImagesImpl.getByGallery(GalleryImagesImpl.java:91)
at com.some.package.AzureClient.getGalleryImage(MyAzureClient.java:348)
To Reproduce
Just use the below code and ensure the gallery doesn't exist:
azure.galleries().getByResourceGroup(targetRg, galleryName);
Code Snippet
Added above.
Expected behavior
It should return null and let the consumer work with it how it does for other resource types.
For e.g. when I do the same for a public IP address, the below code will print null.
Screenshots
N/A
Setup (please complete the following information):
Additional Context
Btw the below code works just fine if I supply the resourceId of a Gallery or GalleryImage and prints null but isn't an ideal workaround if I want to only work with the resource group name and the resource name.
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: