private void checkParameter(ApiMethod apiMethod, Properties parameters)
     throws ApiException, Throwable {
   try {
     List<ApiMethodParameter> apiParameters = apiMethod.getParameters();
     if (null == apiParameters || apiParameters.isEmpty()) {
       return;
     }
     List<ApiError> errors = new ArrayList<ApiError>();
     for (int i = 0; i < apiParameters.size(); i++) {
       ApiMethodParameter apiParam = apiParameters.get(i);
       String paramName = apiParam.getKey();
       Object value = parameters.get(paramName);
       if (apiParam.isRequired() && (null == value || value.toString().trim().length() == 0)) {
         errors.add(
             new ApiError(
                 IApiErrorCodes.API_PARAMETER_REQUIRED,
                 "Parameter '" + paramName + "' is required"));
       }
     }
     if (!errors.isEmpty()) {
       throw new ApiException(errors);
     }
   } catch (ApiException t) {
     throw t;
   } catch (Throwable t) {
     ApsSystemUtils.logThrowable(t, this, "checkParameter", "Error checking api parameters");
     throw new ApsSystemException("Internal Error", t);
   }
 }
 private void checkParameters() {
   try {
     this.setApiParameterValues(new ApsProperties());
     ApiMethod masterMethod = this.getMethod(this.getApiMethodName());
     List<ApiMethodParameter> apiParameters = masterMethod.getParameters();
     this.setApiParameters(apiParameters);
     for (int i = 0; i < apiParameters.size(); i++) {
       ApiMethodParameter apiParameter = apiParameters.get(i);
       String fieldName = apiParameter.getKey() + "_apiParam";
       String value = this.getRequest().getParameter(fieldName);
       if (null != value && value.trim().length() > 0) {
         this.getApiParameterValues().put(apiParameter.getKey(), value);
       }
       boolean isFreeParameter =
           (null != this.getFreeParameters())
               ? this.getFreeParameters().contains(apiParameter.getKey())
               : false;
       if (apiParameter.isRequired()
           && (null == value || value.trim().length() == 0)
           && !isFreeParameter) {
         this.addFieldError(
             fieldName,
             this.getText(
                 "error.service.parameter.invalidSetting",
                 new String[] {apiParameter.getKey(), apiParameter.getDescription()}));
       }
     }
   } catch (Throwable t) {
     ApsSystemUtils.logThrowable(t, this, "checkParameters");
     throw new RuntimeException("Error checking parameters", t);
   }
 }