swagger-api/swagger-codegen

null pointer exception in networkResponse.statusCode

オープン

#3,628 opened on 2016/08/23

 (6 件のコメント) (0 件のリアクション) (0 人の担当者)HTML (5,474 件のフォーク)batch import
Client: AndroidIssue: Bughelp wanted

Repository metrics

Stars
 (12,701 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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());

コントリビューターガイド