error: unreported exception TimeoutException; must be caught or declared to be thrown
error: unreported exception TimeoutException; must be caught or declared to be thrown
Generated Android Client Code
LoginActivity.java
LoginApi apiInstance = new LoginApi(); String targetDomainKey = ""; // String | If the user belongs to an existing domain
try{
UserDomain result = apiInstance.login(mEmailView.getText().toString(), mPasswordView.getText().toString(), targetDomainKey);
}catch(ApiException e){
e.printStackTrace();
}
LoginApi.java
public UserDomain login (String email, String passwd, String targetDomainKey) throws TimeoutException, ExecutionException, InterruptedException, ApiException { Object postBody = null; // verify the required parameter 'email' is set if (email == null) { VolleyError error = new VolleyError("Missing the required parameter 'email' when calling login", new ApiException(400, "Missing the required parameter 'email' when calling login")); } // verify the required parameter 'passwd' is set if (passwd == null) { VolleyError error = new VolleyError("Missing the required parameter 'passwd' when calling login", new ApiException(400, "Missing the required parameter 'passwd' when calling login")); }
// create path and map variables
String path = "/domain/login/{email}/{passwd}".replaceAll("\\{" + "email" + "\\}", apiInvoker.escapeString(email.toString())).replaceAll("\\{" + "passwd" + "\\}", apiInvoker.escapeString(passwd.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
queryParams.addAll(ApiInvoker.parameterToPairs("", "targetDomainKey", targetDomainKey));
String[] contentTypes = {
"application/json"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
// normal form params
}
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (UserDomain) ApiInvoker.deserialize(localVarResponse, "", UserDomain.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
Too many version compatibility issues on dependency libs. Read lot of solutions from forums. They recommended for downgrade the api version. But i can't, So I remove that complete generated codes. Now simply using retrofit for my Api calls integration. Every thing working good.