@@ -63,7 +63,7 @@ public void reset() {
6363 @ Override
6464 public void exportAssets (
6565 ExportAssetsRequest request , StreamObserver <Operation > responseObserver ) {
66- Object response = responses .remove ();
66+ Object response = responses .poll ();
6767 if (response instanceof Operation ) {
6868 requests .add (request );
6969 responseObserver .onNext (((Operation ) response ));
@@ -75,7 +75,7 @@ public void exportAssets(
7575 new IllegalArgumentException (
7676 String .format (
7777 "Unrecognized response type %s for method ExportAssets, expected %s or %s" ,
78- response .getClass ().getName (),
78+ response == null ? "null" : response .getClass ().getName (),
7979 Operation .class .getName (),
8080 Exception .class .getName ())));
8181 }
@@ -85,7 +85,7 @@ public void exportAssets(
8585 public void batchGetAssetsHistory (
8686 BatchGetAssetsHistoryRequest request ,
8787 StreamObserver <BatchGetAssetsHistoryResponse > responseObserver ) {
88- Object response = responses .remove ();
88+ Object response = responses .poll ();
8989 if (response instanceof BatchGetAssetsHistoryResponse ) {
9090 requests .add (request );
9191 responseObserver .onNext (((BatchGetAssetsHistoryResponse ) response ));
@@ -97,15 +97,15 @@ public void batchGetAssetsHistory(
9797 new IllegalArgumentException (
9898 String .format (
9999 "Unrecognized response type %s for method BatchGetAssetsHistory, expected %s or %s" ,
100- response .getClass ().getName (),
100+ response == null ? "null" : response .getClass ().getName (),
101101 BatchGetAssetsHistoryResponse .class .getName (),
102102 Exception .class .getName ())));
103103 }
104104 }
105105
106106 @ Override
107107 public void createFeed (CreateFeedRequest request , StreamObserver <Feed > responseObserver ) {
108- Object response = responses .remove ();
108+ Object response = responses .poll ();
109109 if (response instanceof Feed ) {
110110 requests .add (request );
111111 responseObserver .onNext (((Feed ) response ));
@@ -117,13 +117,15 @@ public void createFeed(CreateFeedRequest request, StreamObserver<Feed> responseO
117117 new IllegalArgumentException (
118118 String .format (
119119 "Unrecognized response type %s for method CreateFeed, expected %s or %s" ,
120- response .getClass ().getName (), Feed .class .getName (), Exception .class .getName ())));
120+ response == null ? "null" : response .getClass ().getName (),
121+ Feed .class .getName (),
122+ Exception .class .getName ())));
121123 }
122124 }
123125
124126 @ Override
125127 public void getFeed (GetFeedRequest request , StreamObserver <Feed > responseObserver ) {
126- Object response = responses .remove ();
128+ Object response = responses .poll ();
127129 if (response instanceof Feed ) {
128130 requests .add (request );
129131 responseObserver .onNext (((Feed ) response ));
@@ -135,14 +137,16 @@ public void getFeed(GetFeedRequest request, StreamObserver<Feed> responseObserve
135137 new IllegalArgumentException (
136138 String .format (
137139 "Unrecognized response type %s for method GetFeed, expected %s or %s" ,
138- response .getClass ().getName (), Feed .class .getName (), Exception .class .getName ())));
140+ response == null ? "null" : response .getClass ().getName (),
141+ Feed .class .getName (),
142+ Exception .class .getName ())));
139143 }
140144 }
141145
142146 @ Override
143147 public void listFeeds (
144148 ListFeedsRequest request , StreamObserver <ListFeedsResponse > responseObserver ) {
145- Object response = responses .remove ();
149+ Object response = responses .poll ();
146150 if (response instanceof ListFeedsResponse ) {
147151 requests .add (request );
148152 responseObserver .onNext (((ListFeedsResponse ) response ));
@@ -154,15 +158,15 @@ public void listFeeds(
154158 new IllegalArgumentException (
155159 String .format (
156160 "Unrecognized response type %s for method ListFeeds, expected %s or %s" ,
157- response .getClass ().getName (),
161+ response == null ? "null" : response .getClass ().getName (),
158162 ListFeedsResponse .class .getName (),
159163 Exception .class .getName ())));
160164 }
161165 }
162166
163167 @ Override
164168 public void updateFeed (UpdateFeedRequest request , StreamObserver <Feed > responseObserver ) {
165- Object response = responses .remove ();
169+ Object response = responses .poll ();
166170 if (response instanceof Feed ) {
167171 requests .add (request );
168172 responseObserver .onNext (((Feed ) response ));
@@ -174,13 +178,15 @@ public void updateFeed(UpdateFeedRequest request, StreamObserver<Feed> responseO
174178 new IllegalArgumentException (
175179 String .format (
176180 "Unrecognized response type %s for method UpdateFeed, expected %s or %s" ,
177- response .getClass ().getName (), Feed .class .getName (), Exception .class .getName ())));
181+ response == null ? "null" : response .getClass ().getName (),
182+ Feed .class .getName (),
183+ Exception .class .getName ())));
178184 }
179185 }
180186
181187 @ Override
182188 public void deleteFeed (DeleteFeedRequest request , StreamObserver <Empty > responseObserver ) {
183- Object response = responses .remove ();
189+ Object response = responses .poll ();
184190 if (response instanceof Empty ) {
185191 requests .add (request );
186192 responseObserver .onNext (((Empty ) response ));
@@ -192,7 +198,7 @@ public void deleteFeed(DeleteFeedRequest request, StreamObserver<Empty> response
192198 new IllegalArgumentException (
193199 String .format (
194200 "Unrecognized response type %s for method DeleteFeed, expected %s or %s" ,
195- response .getClass ().getName (),
201+ response == null ? "null" : response .getClass ().getName (),
196202 Empty .class .getName (),
197203 Exception .class .getName ())));
198204 }
@@ -202,7 +208,7 @@ public void deleteFeed(DeleteFeedRequest request, StreamObserver<Empty> response
202208 public void searchAllResources (
203209 SearchAllResourcesRequest request ,
204210 StreamObserver <SearchAllResourcesResponse > responseObserver ) {
205- Object response = responses .remove ();
211+ Object response = responses .poll ();
206212 if (response instanceof SearchAllResourcesResponse ) {
207213 requests .add (request );
208214 responseObserver .onNext (((SearchAllResourcesResponse ) response ));
@@ -214,7 +220,7 @@ public void searchAllResources(
214220 new IllegalArgumentException (
215221 String .format (
216222 "Unrecognized response type %s for method SearchAllResources, expected %s or %s" ,
217- response .getClass ().getName (),
223+ response == null ? "null" : response .getClass ().getName (),
218224 SearchAllResourcesResponse .class .getName (),
219225 Exception .class .getName ())));
220226 }
@@ -224,7 +230,7 @@ public void searchAllResources(
224230 public void searchAllIamPolicies (
225231 SearchAllIamPoliciesRequest request ,
226232 StreamObserver <SearchAllIamPoliciesResponse > responseObserver ) {
227- Object response = responses .remove ();
233+ Object response = responses .poll ();
228234 if (response instanceof SearchAllIamPoliciesResponse ) {
229235 requests .add (request );
230236 responseObserver .onNext (((SearchAllIamPoliciesResponse ) response ));
@@ -236,7 +242,7 @@ public void searchAllIamPolicies(
236242 new IllegalArgumentException (
237243 String .format (
238244 "Unrecognized response type %s for method SearchAllIamPolicies, expected %s or %s" ,
239- response .getClass ().getName (),
245+ response == null ? "null" : response .getClass ().getName (),
240246 SearchAllIamPoliciesResponse .class .getName (),
241247 Exception .class .getName ())));
242248 }
@@ -245,7 +251,7 @@ public void searchAllIamPolicies(
245251 @ Override
246252 public void analyzeIamPolicy (
247253 AnalyzeIamPolicyRequest request , StreamObserver <AnalyzeIamPolicyResponse > responseObserver ) {
248- Object response = responses .remove ();
254+ Object response = responses .poll ();
249255 if (response instanceof AnalyzeIamPolicyResponse ) {
250256 requests .add (request );
251257 responseObserver .onNext (((AnalyzeIamPolicyResponse ) response ));
@@ -257,7 +263,7 @@ public void analyzeIamPolicy(
257263 new IllegalArgumentException (
258264 String .format (
259265 "Unrecognized response type %s for method AnalyzeIamPolicy, expected %s or %s" ,
260- response .getClass ().getName (),
266+ response == null ? "null" : response .getClass ().getName (),
261267 AnalyzeIamPolicyResponse .class .getName (),
262268 Exception .class .getName ())));
263269 }
@@ -266,7 +272,7 @@ public void analyzeIamPolicy(
266272 @ Override
267273 public void analyzeIamPolicyLongrunning (
268274 AnalyzeIamPolicyLongrunningRequest request , StreamObserver <Operation > responseObserver ) {
269- Object response = responses .remove ();
275+ Object response = responses .poll ();
270276 if (response instanceof Operation ) {
271277 requests .add (request );
272278 responseObserver .onNext (((Operation ) response ));
@@ -278,7 +284,7 @@ public void analyzeIamPolicyLongrunning(
278284 new IllegalArgumentException (
279285 String .format (
280286 "Unrecognized response type %s for method AnalyzeIamPolicyLongrunning, expected %s or %s" ,
281- response .getClass ().getName (),
287+ response == null ? "null" : response .getClass ().getName (),
282288 Operation .class .getName (),
283289 Exception .class .getName ())));
284290 }
0 commit comments