File tree 3 files changed +41
-3
lines changed
client-http/src/main/java/com/cloudera/livy/client/http
integration-test/src/test/scala/com/cloudera/livy/test
test-lib/src/main/java/com/cloudera/livy/test/jobs
3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -235,9 +235,11 @@ public void run() {
235
235
236
236
switch (status .state ) {
237
237
case SUCCEEDED :
238
- @ SuppressWarnings ("unchecked" )
239
- T localResult = (T ) serializer .deserialize (ByteBuffer .wrap (status .result ));
240
- result = localResult ;
238
+ if (status .result != null ) {
239
+ @ SuppressWarnings ("unchecked" )
240
+ T localResult = (T ) serializer .deserialize (ByteBuffer .wrap (status .result ));
241
+ result = localResult ;
242
+ }
241
243
finished = true ;
242
244
break ;
243
245
Original file line number Diff line number Diff line change @@ -190,6 +190,13 @@ class JobApiIT extends BaseIntegrationTestSuite with BeforeAndAfterAll with Logg
190
190
assert(result === " foo" )
191
191
}
192
192
193
+ test(" return null should not throw NPE" ) {
194
+ assume(client2 != null , " Client not active" )
195
+
196
+ val result = waitFor(client2.submit(new VoidJob ()))
197
+ assert(result === null )
198
+ }
199
+
193
200
test(" destroy the session" ) {
194
201
assume(client2 != null , " Client not active." )
195
202
client2.stop(true )
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Licensed to Cloudera, Inc. under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. Cloudera, Inc. licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ package com .cloudera .livy .test .jobs ;
20
+
21
+ import com .cloudera .livy .Job ;
22
+ import com .cloudera .livy .JobContext ;
23
+
24
+ public class VoidJob implements Job <Void > {
25
+ @ Override
26
+ public Void call (JobContext jc ) {
27
+ return null ;
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments