swagger-api/swagger-codegen

null pointer exception in networkResponse.statusCode

開放

#3,628 建立於 2016年8月23日

 (6 則留言) (0 個反應) (0 位負責人)HTML (5,474 個分叉)batch import
Client: AndroidIssue: Bughelp wanted

倉庫指標

星標
 (12,701 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

The following is the swagger generated code for android:-

try {
        String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
        if(localVarResponse != null){
           return (Lxlresponse) ApiInvoker.deserialize(localVarResponse, "", Lxlresponse.class);
        } else {
           return null;
        }
      } catch (ApiException ex) {
         throw ex;
      } catch (InterruptedException ex) {
         throw ex;
      } catch (ExecutionException ex) {

         if(ex.getCause() instanceof VolleyError) {

             throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
         }
         throw ex;
      } catch (TimeoutException ex) {
         throw ex;
      }
  }

In the above code, at the following line i'm getting null pointer exception, when there is no response from server:-

throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());

貢獻者指南