Example usage for org.springframework.web.client HttpServerErrorException getMessage

List of usage examples for org.springframework.web.client HttpServerErrorException getMessage

Introduction

In this page you can find the example usage for org.springframework.web.client HttpServerErrorException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:io.syndesis.rest.v1.handler.exception.HttpServerErrorExceptionMapper.java

@Override
public Response toResponse(HttpServerErrorException exception) {
    RestError error = new RestError(exception.getMessage(), exception.getMessage(),
            ErrorMap.from(new String(exception.getResponseBodyAsByteArray(), StandardCharsets.UTF_8)),
            exception.getStatusCode().value());
    return Response.status(exception.getStatusCode().value()).type(MediaType.APPLICATION_JSON_TYPE)
            .entity(error).build();// w w w  . j  a v a  2s .c  om
}

From source file:br.com.modoagil.asr.rest.support.RESTErrorHandler.java

/**
 * Manipula exceo para status HTTP {@code 5xx}, exceo do servidor
 *
 * @param ex/* w  w  w  .j  a  v  a 2  s.  co m*/
 *            {@link HttpServerErrorException}
 * @return resposta ao cliente
 */
@ResponseBody
@ExceptionHandler(HttpServerErrorException.class)
public Response<E> processHttpServerErrorException(final HttpServerErrorException ex) {
    this.logger.info("handleHttpServerErrorException - Catching: " + ex.getClass().getSimpleName(), ex);
    return new ResponseBuilder<E>().success(false).message(ex.getMessage()).status(ex.getStatusCode()).build();
}

From source file:org.eclipse.cft.server.core.internal.client.UpdateServicesOperation.java

@Override
public void run(IProgressMonitor monitor) throws CoreException {
    try {//from   ww w  . j  ava  2 s.  co  m
        List<CFServiceInstance> existingServices = request.run(monitor);
        ServerEventHandler.getDefault().fireServicesUpdated(getBehaviour().getCloudFoundryServer(),
                existingServices);
    } catch (CoreException e) {
        // See if it is an HttpServerErrorException (thrown when receiving,
        // for example, 5xx).
        // If so, parse it into readable form. This follows the pattern of
        // CloudErrorUtil.asCoreException(...)
        CoreException rethrow = e;
        if (e.getCause() instanceof HttpServerErrorException) {
            HttpServerErrorException hsee = (HttpServerErrorException) e.getCause();

            // Wrap the status inner exception into a new exception to allow the UI to properly display the full error message
            ServiceCreationFailedException scfe = new ServiceCreationFailedException(
                    hsee.getStatusCode() + " " + hsee.getStatusCode().getReasonPhrase(), hsee);
            Status newStatus = new Status(e.getStatus().getSeverity(), e.getStatus().getPlugin(),
                    e.getStatus().getCode(), hsee.getMessage(), scfe);

            rethrow = new CoreException(newStatus);
        }

        logNonModuleError(rethrow);
        throw rethrow;
    }
}

From source file:com.wavemaker.tools.deployment.cloudfoundry.CloudFoundryDeploymentTarget.java

private String doDeploy(ApplicationArchive applicationArchive, DeploymentInfo deploymentInfo,
        boolean checkExist) throws DeploymentStatusException {
    try {//from w  w w .jav  a2s  .  com
        CloudFoundryClient client = getClient(deploymentInfo);
        String url = createApplication(client, deploymentInfo, checkExist);
        log.info("Preparing: " + url);
        setupServices(client, deploymentInfo);
        uploadAppliation(client, deploymentInfo.getApplicationName(), applicationArchive);
        try {
            CloudApplication application = client.getApplication(deploymentInfo.getApplicationName());
            if (application.getState().equals(CloudApplication.AppState.STARTED)) {
                doRestart(deploymentInfo, client);
            } else {
                doStart(deploymentInfo, client);
            }
        } catch (CloudFoundryException ex) {
            throw new DeploymentStatusException("ERROR: Could not start application. " + ex.getDescription(),
                    ex);
        }
        if (!url.startsWith("http://")) {
            url = "http://" + url;
        }
        return url;
    } catch (HttpServerErrorException e) {
        throw new DeploymentStatusException("ERROR: Clould not deploy application due to remote exception\n"
                + e.getMessage() + "\n\n" + e.getStatusText());
    }
}

From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderRequestRenderer.java

private void orderRequestDownload(final MarketplaceStoreModel model) {
    if (null == model.getRequestStartTime()) {
        NotificationUtils//  w ww  .  jav a  2  s.c om
                .notifyUserVia(
                        Localization.getLocalizedString(
                                "type.Marketplacestore." + MarketplaceStoreModel.REQUESTSTARTTIME + ".name")
                                + " " + Labels.getLabel("backoffice.field.notfilled"),
                        NotificationEvent.Type.WARNING, "");
        LOG.warn("Order request start time is not filled!");
        return;
    } else if (null == model.getRequestEndTime()) {
        NotificationUtils.notifyUserVia(Localization
                .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.REQUESTENDTIME + ".name")
                + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, "");
        LOG.warn("Order request end time is not filled!");
        return;
    } else if (model.getRequestStartTime().after(model.getRequestEndTime())) {
        NotificationUtils.notifyUserVia(Labels.getLabel("backoffice.field.timerange.error"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("start time is greater than end time!");
        return;
    }

    if (!StringUtils.isBlank(model.getIntegrationId()) && !model.getAuthorized().booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("authorization is expired!");
        return;
    }
    //in order to avoid this value out of date, we only get it from database
    final Boolean isAuth = ((MarketplaceStoreModel) modelService.get(model.getPk())).getAuthorized();
    final String integrationId = ((MarketplaceStoreModel) modelService.get(model.getPk())).getIntegrationId();
    model.setIntegrationId(integrationId);
    model.setAuthorized(isAuth);
    if (null == isAuth || !isAuth.booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.unauthed"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("marketplace store do not authorized, download refund/return order failed!");
        return;
    }

    String urlStr = "";
    final String logUUID = logUtil.getUUID();
    final MarketplaceSellerModel seller = model.getMarketplaceSeller();
    final MarketplaceModel marketPlace = seller.getMarketplace();

    try {
        // Configure and open a connection to the site you will send the
        urlStr = marketPlace.getAdapterUrl() + Config.getParameter(MARKETPLACE_REFUND_SYCHRONIZE_PATH)
                + Config.getParameter(MARKETPLACE_REFUND_REQUEST_PATH) + integrationId
                + Config.getParameter(MARKETPLACE_REFUND_REQUEST_LOGUUID) + logUUID;
        final JSONObject jsonObj = new JSONObject();
        jsonObj.put("batchSize", BATCH_SIZE);

        //set the correct timezone
        final String configTimezone = model.getMarketplace().getTimezone();
        boolean isValidTimezone = false;
        for (final String vaildTimezone : TimeZone.getAvailableIDs()) {
            if (vaildTimezone.equals(configTimezone)) {
                isValidTimezone = true;
                break;
            }
        }

        if (!isValidTimezone) {
            final String[] para = { configTimezone == null ? "" : configTimezone,
                    model.getMarketplace().getName() };
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.wrongtimezone", para),
                    NotificationEvent.Type.WARNING, "");
            LOG.warn("wrong timezone or missing timezone configed in market:"
                    + model.getMarketplace().getName());
            return;
        }

        final SimpleDateFormat format = new SimpleDateFormat(Config.getParameter(BACKOFFICE_FORMAT_DATEFORMAT));
        format.setTimeZone(TimeZone.getTimeZone(configTimezone));

        final String startTimeWithCorrectZone = format.format(model.getRequestStartTime()).toString();
        final String endTimeWithCorrectZone = format.format(model.getRequestEndTime()).toString();

        logUtil.addMarketplaceLog("PENDING", integrationId,
                Labels.getLabel("marketplace.order.requestorder.action"), model.getItemtype(), marketPlace,
                model, logUUID);

        jsonObj.put("startCreated", startTimeWithCorrectZone);
        jsonObj.put("endCreated", endTimeWithCorrectZone);
        jsonObj.put("productCatalogVersion",
                model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion());
        jsonObj.put("currency", model.getCurrency().getIsocode());
        marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString());
    } catch (final HttpClientErrorException httpError) {
        if (httpError.getStatusCode().is4xxClientError()) {
            LOG.error("=========================================================================");
            LOG.error("Order Request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Tmall service URL is not correct!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        if (httpError.getStatusCode().is5xxServerError()) {
            LOG.error("=========================================================================");
            LOG.error("Order Request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Json Ojbect is not correct!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        LOG.error(httpError.toString());
        return;
    } catch (final ResourceAccessException raError) {
        LOG.error("=========================================================================");
        LOG.error("Order Request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Order Request server access failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + raError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final HttpServerErrorException serverError) {
        LOG.error("=========================================================================");
        LOG.error("Order Request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Order Request server process failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + serverError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final Exception e) {
        LOG.error("=========================================================================");
        LOG.error("Order Request failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Order Request server process failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + e.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.fail"),
                NotificationEvent.Type.FAILURE, "");
        return;
    }
    NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.success"),
            NotificationEvent.Type.SUCCESS, "");
}

From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderInitialRenderer.java

private void initialOrderDownload(final MarketplaceStoreModel model) {
    if (null == model.getOrderStartTime()) {
        NotificationUtils.notifyUserVia(Localization
                .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.ORDERSTARTTIME + ".name")
                + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, "");
        LOG.warn("get order start time is not filled!");
        return;/*from   w w  w.  j  a va2s  .c om*/
    } else if (null == model.getOrderEndTime()) {
        NotificationUtils.notifyUserVia(Localization
                .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.ORDERENDTIME + ".name")
                + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, "");
        LOG.warn("get order end time is not filled!");
        return;
    } else if (model.getOrderStartTime().after(model.getOrderEndTime())) {
        NotificationUtils.notifyUserVia(Labels.getLabel("backoffice.field.timerange.error"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("start time is greate than end time!");
        return;
    } else if (model.getMarketplace().getTmallOrderStatus().isEmpty()
            || null == model.getMarketplace().getTmallOrderStatus()) {
        NotificationUtils.notifyUserVia(
                Localization
                        .getLocalizedString("type.Marketplace." + MarketplaceModel.TMALLORDERSTATUS + ".name")
                        + " " + Labels.getLabel("backoffice.field.notfilled"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("order status field is not filled!");
        return;
    }
    if (!StringUtils.isBlank(model.getIntegrationId()) && !model.getAuthorized().booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("authorization is expired!");
        return;
    }
    // in order to avoid this value out of date, we only get it from
    // database
    final Boolean isAuth = ((MarketplaceStoreModel) modelService.get(model.getPk())).getAuthorized();
    final String integrationId = ((MarketplaceStoreModel) modelService.get(model.getPk())).getIntegrationId();
    model.setIntegrationId(integrationId);
    model.setAuthorized(isAuth);
    if (null == isAuth || !isAuth.booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.unauthed"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("marketplace store do not authorized, initial download failed!");
        return;
    }

    String urlStr = "";
    final String logUUID = logUtil.getUUID();
    final MarketplaceSellerModel seller = model.getMarketplaceSeller();
    final MarketplaceModel marketPlace = seller.getMarketplace();
    try {

        // Configure and open a connection to the site you will send the
        urlStr = marketPlace.getAdapterUrl() + Config.getParameter(MARKETPLACE_ORDER_SYCHRONIZE_PATH)
                + Config.getParameter(MARKETPLACE_ORDER_INITIAL_PATH) + integrationId
                + Config.getParameter(MARKETPLACE_ORDER_INITIAL_LOGUUID) + logUUID;
        final JSONObject jsonObj = new JSONObject();
        jsonObj.put("batchSize", BATCH_SIZE);
        jsonObj.put("status", getOrderStatus(model.getMarketplace().getTmallOrderStatus()));
        //jsonObj.put("marketplaceLogId", marketplacelogUUID);
        // set the correct timezone
        final String configTimezone = model.getMarketplace().getTimezone();
        boolean isValidTimezone = false;
        for (final String vaildTimezone : TimeZone.getAvailableIDs()) {
            if (vaildTimezone.equals(configTimezone)) {
                isValidTimezone = true;
                break;
            }
        }

        if (!isValidTimezone) {
            final String[] para = { configTimezone == null ? "" : configTimezone,
                    model.getMarketplace().getName() };
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.wrongtimezone", para),
                    NotificationEvent.Type.WARNING, "");
            LOG.warn("wrong timezone or missing timezone configed in market:"
                    + model.getMarketplace().getName());
            return;
        }

        final SimpleDateFormat format = new SimpleDateFormat(Config.getParameter(BACKOFFICE_FORMAT_DATEFORMAT));
        format.setTimeZone(TimeZone.getTimeZone(configTimezone));

        final String startTimeWithCorrectZone = format.format(model.getOrderStartTime()).toString();
        final String endTimeWithCorrectZone = format.format(model.getOrderEndTime()).toString();

        jsonObj.put("startCreated", startTimeWithCorrectZone);
        jsonObj.put("endCreated", endTimeWithCorrectZone);
        jsonObj.put("productCatalogVersion",
                model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion());
        jsonObj.put("currency", model.getCurrency().getIsocode());

        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.success"),
                NotificationEvent.Type.SUCCESS, "");

        final JSONObject results = marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString());

        final String msg = results.toJSONString();
        final String responseCode = results.get("code").toString();

        if ("401".equals(responseCode)) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + responseCode);
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Authentication was failed, please re-authenticate again!");
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("Authentication was failed, please re-authenticate again!");
            return;
        } else if (!("0".equals(responseCode))) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + responseCode);
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("A known issue occurs in tmall, error details :" + msg);
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(
                    Labels.getLabel("marketplace.tmallapp.known.issues", new Object[] { msg }),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("A known issue occurs in tmall, error details :" + msg);
            return;
        }

    } catch (final HttpClientErrorException httpError) {
        if (httpError.getStatusCode().is4xxClientError()) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Tmall service URL is not correct!");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        if (httpError.getStatusCode().is5xxServerError()) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Json Ojbect is not correct!");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        LOG.error(httpError.toString());
        return;
    } catch (final ResourceAccessException raError) {
        LOG.error("=========================================================================");
        LOG.error("Order initial download request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order download request server access failed!");
        LOG.error("Detail error info: " + raError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final HttpServerErrorException serverError) {
        LOG.error("=========================================================================");
        LOG.error("Order initial download request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order download request server process failed!");
        LOG.error("Detail error info: " + serverError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final Exception e) {
        final String errorMsg = e.getClass().toString() + ":" + e.getMessage();
        NotificationUtils.notifyUserVia(
                Labels.getLabel("marketplace.runtime.issues", new Object[] { errorMsg }),
                NotificationEvent.Type.FAILURE, "");
        LOG.warn(e.getMessage() + e.getStackTrace());
        return;
    }
    LOG.info("=========================================================================");
    LOG.info("Order initial download request post to Tmall suceessfully!");
    LOG.info("-------------------------------------------------------------------------");
    LOG.info("Marketplacestore Code: " + model.getName());
    LOG.info("Request path: " + urlStr);
    LOG.info("=========================================================================");

    //      logUtil.addMarketplaceLog("PENDING", model.getIntegrationId(), Labels.getLabel("marketplace.order.initial.action"),
    //            Labels.getLabel("marketplace.order.initial.object.type"), marketPlace, model, logUUID);
}

From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderIncrementalRenderer.java

private boolean incrementalOrderDownload(final MarketplaceStoreModel model, final String status) {
    boolean flag = false;
    final String logUUID = logUtil.getUUID();
    final MarketplaceSellerModel seller = model.getMarketplaceSeller();
    final MarketplaceModel marketPlace = seller.getMarketplace();
    modelService.refresh(seller);/* www. j  a v a2s. c o  m*/

    final String requestUrl = marketPlace.getAdapterUrl()
            + Config.getParameter(MARKETPLACE_ORDER_REALTIME_SYNC_PATH)
            + Config.getParameter(MARKETPLACE_ORDER_SYCHRONIZE_MIDDLE_PATH) + model.getIntegrationId()
            + Config.getParameter(MARKETPLACE_ORDER_SYCHRONIZE_LOGUUID) + logUUID;
    final JSONObject jsonObj = new JSONObject();
    jsonObj.put("currency", model.getCurrency().getIsocode());
    jsonObj.put("productCatalogVersion",
            model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion());
    jsonObj.put("status", status);

    try {
        this.saveMarketplaceLog(status, model, logUUID);

        final JSONObject results = marketplaceHttpUtil.post(requestUrl, jsonObj.toJSONString());
        final String msg = results.toJSONString();
        final String responseCode = results.get("code").toString();

        if ("401".equals(responseCode)) {
            LOG.error("=========================================================================");
            LOG.error("Order incremental download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + responseCode);
            LOG.error("Request path: " + requestUrl);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Authentication was failed, please re-authenticate again!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("Authentication was failed, please re-authenticate again!");
        } else if (!("0".equals(responseCode))) {
            LOG.error("=========================================================================");
            LOG.error("Order incremental download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + responseCode);
            LOG.error("Request path: " + requestUrl);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("A known issue occurs in tmall, error details :" + msg);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("=========================================================================");
            /*
             * NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.tmallapp.known.issues", new Object[] { msg
             * }), NotificationEvent.Type.FAILURE, "");
             */
            LOG.warn("A known issue occurs in tmall, error details :" + msg);
        } else if ("0".equals(responseCode)) {
            LOG.debug("Open listen sucessfully");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.incremental.order.success"),
                    NotificationEvent.Type.SUCCESS, "");
            flag = true;
            LOG.info("=========================================================================");
            LOG.info("Order incremental download request post to Tmall suceessfully!");
            LOG.info("-------------------------------------------------------------------------");
            LOG.info("Marketplacestore Code: " + model.getName());
            LOG.info("Request path: " + requestUrl);
            LOG.info("=========================================================================");

        }
    } catch (final HttpClientErrorException httpError) {
        if (httpError.getStatusCode().is4xxClientError()) {
            LOG.error("=========================================================================");
            LOG.error("Order incremental download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + requestUrl);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Tmall service URL is not correct!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"),
                    NotificationEvent.Type.FAILURE, "");

        }
        if (httpError.getStatusCode().is5xxServerError()) {
            LOG.error("=========================================================================");
            LOG.error("Order incremental download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + requestUrl);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Json Ojbect is not correct!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        LOG.error(httpError.toString());
        return flag;
    } catch (final ResourceAccessException raError) {
        LOG.error("=========================================================================");
        LOG.error("Order incremental download request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + requestUrl);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order download request server access failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + raError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"),
                NotificationEvent.Type.FAILURE, "");
        return flag;
    } catch (final HttpServerErrorException serverError) {
        LOG.error("=========================================================================");
        LOG.error("Order incremental download request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + requestUrl);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order download request server process failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + serverError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                NotificationEvent.Type.FAILURE, "");
        return flag;
    } catch (final Exception e) {
        final String errorMsg = e.getClass().toString() + ":" + e.getMessage();
        NotificationUtils.notifyUserVia(
                Labels.getLabel("marketplace.runtime.issues", new Object[] { errorMsg }),
                NotificationEvent.Type.FAILURE, "");
        LOG.error("=========================================================================");
        LOG.error("Order incremental download request failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + requestUrl);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + e.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                NotificationEvent.Type.FAILURE, "");
        LOG.warn(e.getMessage() + e.getStackTrace());
        return flag;
    }
    return flag;
}

From source file:de.hybris.platform.mpintgomsbackoffice.actions.sync.SyncToMarketplaceAction.java

@Override
public ActionResult<ConsignmentModel> perform(final ActionContext<ConsignmentModel> actionContext) {

    String result = StringUtils.EMPTY;
    final ConsignmentModel consignment = actionContext.getData();
    final TmallOrderModel order = (TmallOrderModel) consignment.getOrder();
    if (order == null) {
        result = ActionResult.ERROR;//from   w w  w .jav  a2  s .  c  o  m
        final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
        actionResult.getStatusFlags().add(ActionResult.StatusFlag.OBJECT_PERSISTED);
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.integrity.error"),
                NotificationEvent.Type.FAILURE, "");
        LOG.warn("Can not find corresponding order for this consignment: " + consignment.getCode());
        return actionResult;
    }

    final Set<ConsignmentEntryModel> consignmentEntries = consignment.getConsignmentEntries();
    final Set<ConsignmentModel> consignments = order.getConsignments();
    String subTid = "";
    String urlStr = "";
    String marketplaceLogId = "";

    getModelService().save(consignment);

    if (StringUtils.isBlank(order.getMarketplaceStore().getIntegrationId())) {
        NotificationUtils.notifyUserVia(
                Labels.getLabel("marketplace.consignment.request.url.error",
                        new Object[] { order.getMarketplaceStore().getName() }),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("authorization is expired!");
        result = ActionResult.ERROR;
        final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
        actionResult.getStatusFlags().add(ActionResult.StatusFlag.OBJECT_PERSISTED);
        return actionResult;
    } else if (StringUtils.isBlank(consignment.getMarketplaceTrackingID())) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.trackingid.empty"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("Confirm failed due to trackingid is empty for model " + consignment);
        result = ActionResult.ERROR;
        final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
        actionResult.getStatusFlags().add(ActionResult.StatusFlag.OBJECT_PERSISTED);
        return actionResult;
    } else if (null == consignment.getStandardCarrier()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.carrier.null"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("Confirm failed due to carrier is null for model " + consignment);
        result = ActionResult.ERROR;
        final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
        actionResult.getStatusFlags().add(ActionResult.StatusFlag.OBJECT_PERSISTED);
        return actionResult;
    }

    if (!MARKETPLACE_CONSIGNMENT_CONFIRM_STATUS.equals(order.getTmallOrderStatus().getCode())) {
        if (!MARKETPLACE_CONSIGNMENT_PART_STATUS.equals(order.getTmallOrderStatus().getCode())) {
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.status.fail"),
                    NotificationEvent.Type.WARNING, "");
            LOG.warn("Confirm failed due to order status is not correct!");
            result = ActionResult.ERROR;
            final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
            actionResult.getStatusFlags().add(ActionResult.StatusFlag.OBJECT_PERSISTED);
            return actionResult;
        }
    }

    for (final ConsignmentEntryModel consignmententry : consignmentEntries) {
        final TmallOrderEntryModel tmallOrderEntry = (TmallOrderEntryModel) consignmententry.getOrderEntry();
        subTid = subTid + tmallOrderEntry.getOid() + ",";
        if (RefundStatus.WAIT_SELLER_AGREE.equals(tmallOrderEntry.getRefundStatus())
                || RefundStatus.WAIT_BUYER_RETURN_GOODS.equals(tmallOrderEntry.getRefundStatus())
                || RefundStatus.WAIT_SELLER_CONFIRM_GOODS.equals(tmallOrderEntry.getRefundStatus())
                || RefundStatus.SUCCESS.equals(tmallOrderEntry.getRefundStatus())) {
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.status.fail"),
                    NotificationEvent.Type.WARNING, "");
            LOG.warn("Confirm failed due to refund status is not correct!");
            result = ActionResult.ERROR;
            final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
            actionResult.getStatusFlags().add(ActionResult.StatusFlag.OBJECT_PERSISTED);
            return actionResult;
        }
    }

    try {
        marketplaceLogId = marketplaceHttpUtil.getUUID();

        logUtil.addMarketplaceLog("PENDING", consignment.getCode(),
                Labels.getLabel("mpintgomsbackoffice.consignment.action"), consignment.getItemtype(),
                order.getMarketplaceStore().getMarketplace(), consignment, marketplaceLogId);

        urlStr = requestUrl + Config.getParameter(MARKETPLACE_CONSIGNMENT_CONFIRM_PATH);
        final JSONObject jsonObj = new JSONObject();
        jsonObj.put("integrationId", order.getMarketplaceStore().getIntegrationId());
        //Whether splited
        if (consignments.size() > 1) {
            final String isSplit = "1";
            jsonObj.put("isSplit", isSplit);
            jsonObj.put("subTid", subTid);
        }
        jsonObj.put("tmallOrderId", order.getTmallOrderId());
        jsonObj.put("trackingId", consignment.getMarketplaceTrackingID());
        //jsonObj.put("companyCode", consignment.getMarketplaceCarrier().getCode());

        final String standardCarrierPK = consignment.getStandardCarrier().getPk().getLongValueAsString();
        final String marketplacePK = order.getMarketplaceStore().getMarketplace().getPk()
                .getLongValueAsString();

        final String queryString = "SELECT {" + MarketplaceCarrierModel.CODE + "} FROM {"
                + MarketplaceCarrierModel._TYPECODE + "} " + "WHERE {" + MarketplaceCarrierModel.MARKETPLACE
                + "}=?marketplacePK" + " and {" + MarketplaceCarrierModel.STANDARDCARRIER
                + "}=?standardCarrierPK";
        final FlexibleSearchQuery query = new FlexibleSearchQuery(queryString);
        query.addQueryParameter("marketplacePK", marketplacePK);
        query.addQueryParameter("standardCarrierPK", standardCarrierPK);
        final SearchResult<String> companyCode = flexibleSearchService.<String>search(query);
        jsonObj.put("companyCode", companyCode);

        jsonObj.put("marketplaceLogId", marketplaceLogId);
        JSONObject results = new JSONObject();
        results = marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString());

        final String msg = results.toJSONString();
        final String responseCode = results.get("code").toString();

        if ("401".equals(responseCode)) {
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("Authentication was failed, please re-authenticate again!");
            result = ActionResult.ERROR;
        } else if (!("0".equals(responseCode))) {
            NotificationUtils.notifyUserVia(
                    Labels.getLabel("marketplace.tmallapp.known.issues", new Object[] { msg }),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("A known issue occurs in tmall, error details :" + msg);
            result = ActionResult.ERROR;
        }

    } catch (final HttpClientErrorException httpError) {
        if (httpError.getStatusCode().is4xxClientError()) {
            LOG.error("=========================================================================");
            LOG.error("Order consignment upload request post to Datahub failed!");
            LOG.error("Consignment Code: " + consignment.getCode());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Datahub service URL is not correct!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.request.post.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        if (httpError.getStatusCode().is5xxServerError()) {
            LOG.error("=========================================================================");
            LOG.error("Order consignment upload request post to Datahub failed!");
            LOG.error("Consignment Code: " + consignment.getCode());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Json Ojbect is not correct!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.server.process.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        LOG.error(httpError.toString());
        result = ActionResult.ERROR;
        final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
        return actionResult;
    } catch (final ResourceAccessException raError) {
        LOG.error("=========================================================================");
        LOG.error("Order consignment upload request post to Datahub failed!");
        LOG.error("Consignment Code: " + consignment.getCode());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order consignment upload request server access failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + raError.getMessage());
        LOG.error("=========================================================================");
        //LOG.error(raError.toString());
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.server.access.error"),
                NotificationEvent.Type.FAILURE, "");
        result = ActionResult.ERROR;
        final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
        return actionResult;
    } catch (final HttpServerErrorException serverError) {
        LOG.error("=========================================================================");
        LOG.error("Order consignment upload request post to Datahub failed!");
        LOG.error("Consignment Code: " + consignment.getCode());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order consignment upload request server process failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + serverError.getMessage());
        LOG.error("=========================================================================");
        //LOG.error(raError.toString());
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.server.process.error"),
                NotificationEvent.Type.FAILURE, "");
        result = ActionResult.ERROR;
        final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
        return actionResult;
    }

    catch (final Exception e) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.upload.fail"),
                NotificationEvent.Type.FAILURE, "");
        result = ActionResult.ERROR;
        LOG.error("=========================================================================");
        LOG.error("Order consignment failed!");
        LOG.error("Marketplacestore Code: " + consignment.getCode());
        LOG.error("Request path: " + requestUrl);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + e.getMessage());
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("=========================================================================");
        final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
        return actionResult;
    }
    LOG.info("=========================================================================");
    LOG.info("Order consignment upload request post to Datahub suceessfully!");
    LOG.info("Consignment Code: " + consignment.getCode());
    LOG.info("Request path: " + urlStr);
    LOG.info("=========================================================================");
    NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.consignment.upload.success"),
            NotificationEvent.Type.SUCCESS, "");
    result = ActionResult.SUCCESS;
    setFlag(consignment);
    final ActionResult<ConsignmentModel> actionResult = new ActionResult<ConsignmentModel>(result);
    actionResult.getStatusFlags().add(ActionResult.StatusFlag.OBJECT_PERSISTED);
    return actionResult;
}

From source file:org.alfresco.integrations.google.docs.service.GoogleDocsServiceImpl.java

/**
 * Get a connection to the Google APIs. Will attempt to refresh tokens if they are invalid. If unable to refresh return a
 * GoogleDocsRefreshTokenException./*from  w ww  .j  ava 2  s.co  m*/
 * 
 * @return
 * @throws GoogleDocsAuthenticationException
 * @throws GoogleDocsRefreshTokenException
 * @throws GoogleDocsServiceException
 */
private Connection<Google> getConnection()
        throws GoogleDocsAuthenticationException, GoogleDocsRefreshTokenException, GoogleDocsServiceException {
    Connection<Google> connection = null;

    // OAuth credentials for the current user, if the exist
    OAuth2CredentialsInfo credentialInfo = oauth2CredentialsStoreService
            .getPersonalOAuth2Credentials(GoogleDocsConstants.REMOTE_SYSTEM);

    if (credentialInfo != null) {
        log.debug("OAuth Access Token Exists: " + credentialInfo.getOAuthAccessToken());
        AccessGrant accessGrant = new AccessGrant(credentialInfo.getOAuthAccessToken());

        try {
            log.debug("Attempt to create OAuth Connection");
            connection = connectionFactory.createConnection(accessGrant);
        } catch (HttpClientErrorException hcee) {
            log.debug(hcee.getResponseBodyAsString());
            if (hcee.getStatusCode().value() == HttpStatus.SC_UNAUTHORIZED) {
                try {
                    accessGrant = refreshAccessToken();
                    connection = connectionFactory.createConnection(accessGrant);
                } catch (GoogleDocsRefreshTokenException gdrte) {
                    throw gdrte;
                } catch (GoogleDocsServiceException gdse) {
                    throw gdse;
                }
            } else {
                throw new GoogleDocsServiceException(hcee.getMessage(), hcee, hcee.getStatusCode().value());
            }
        } catch (HttpServerErrorException hsee) {
            throw new GoogleDocsServiceException(hsee.getMessage(), hsee, hsee.getStatusCode().value());
        }
    }

    log.debug("Connection Created");
    return connection;
}

From source file:org.cbioportal.annotation.pipeline.MutationRecordReader.java

@Override
public void open(ExecutionContext ec) throws ItemStreamException {

    processComments(ec);//w ww  . j  a v a 2s .c  om

    FlatFileItemReader<MutationRecord> reader = new FlatFileItemReader<>();
    reader.setResource(new FileSystemResource(filename));
    DefaultLineMapper<MutationRecord> mapper = new DefaultLineMapper<>();
    final DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer();
    tokenizer.setDelimiter("\t");
    mapper.setLineTokenizer(tokenizer);
    mapper.setFieldSetMapper(new MutationFieldSetMapper());
    reader.setLineMapper(mapper);
    reader.setLinesToSkip(1);
    reader.setSkippedLinesCallback(new LineCallbackHandler() {
        @Override
        public void handleLine(String line) {
            tokenizer.setNames(line.split("\t"));
        }
    });
    reader.open(ec);

    LOG.info("Loading records from: " + filename);
    MutationRecord mutationRecord;
    try {
        while ((mutationRecord = reader.read()) != null) {
            mutationRecords.add(mutationRecord);
        }
    } catch (Exception e) {
        throw new ItemStreamException(e);
    }
    reader.close();

    int variantsToAnnotateCount = mutationRecords.size();
    int annotatedVariantsCount = 0;
    LOG.info(String.valueOf(variantsToAnnotateCount) + " records to annotate");
    for (MutationRecord record : mutationRecords) {
        annotatedVariantsCount++;
        if (annotatedVariantsCount % 2000 == 0) {
            LOG.info("\tOn record " + String.valueOf(annotatedVariantsCount) + " out of "
                    + String.valueOf(variantsToAnnotateCount) + ", annotation "
                    + String.valueOf((int) (((annotatedVariantsCount * 1.0) / variantsToAnnotateCount) * 100))
                    + "% complete");
        }
        // save variant details for logging
        String variantDetails = "(sampleId,chr,start,end,ref,alt,url)= (" + record.getTUMOR_SAMPLE_BARCODE()
                + "," + record.getCHROMOSOME() + "," + record.getSTART_POSITION() + ","
                + record.getEND_POSITION() + "," + record.getREFERENCE_ALLELE() + ","
                + record.getTUMOR_SEQ_ALLELE2() + "," + annotator.getUrlForRecord(record, isoformOverride)
                + ")";

        // init annotated record w/o genome nexus in case server error occurs
        // if no error then annotated record will get overwritten anyway with genome nexus response
        String serverErrorMessage = "";
        AnnotatedRecord annotatedRecord = new AnnotatedRecord(record);
        try {
            annotatedRecord = annotator.annotateRecord(record, replace, isoformOverride, true);
        } catch (HttpServerErrorException ex) {
            serverErrorMessage = "Failed to annotate variant due to internal server error";
        } catch (HttpClientErrorException ex) {
            serverErrorMessage = "Failed to annotate variant due to client error";
        } catch (HttpMessageNotReadableException ex) {
            serverErrorMessage = "Failed to annotate variant due to message not readable error";
        } catch (GenomeNexusAnnotationFailureException ex) {
            serverErrorMessage = "Failed to annotate variant due to Genome Nexus : " + ex.getMessage();
        }
        annotatedRecords.add(annotatedRecord);
        header.addAll(annotatedRecord.getHeaderWithAdditionalFields());

        // log server failure message if applicable
        if (!serverErrorMessage.isEmpty()) {
            LOG.warn(serverErrorMessage);
            failedAnnotations++;
            failedServerAnnotations++;
            if (errorReportLocation != null)
                updateErrorMessages(record, record.getVARIANT_CLASSIFICATION(),
                        annotator.getUrlForRecord(record, isoformOverride), serverErrorMessage);
            continue;
        }
        String annotationErrorMessage = "";
        if (MafUtil.variantContainsAmbiguousTumorSeqAllele(record.getREFERENCE_ALLELE(),
                record.getTUMOR_SEQ_ALLELE1(), record.getTUMOR_SEQ_ALLELE2())) {
            snpAndIndelVariants++;
            annotationErrorMessage = "Record contains ambiguous SNP and INDEL allele change - SNP allele will be used";
        }
        if (annotatedRecord.getHGVSC().isEmpty() && annotatedRecord.getHGVSP().isEmpty()) {
            if (annotator.isHgvspNullClassifications(annotatedRecord.getVARIANT_CLASSIFICATION())) {
                failedNullHgvspAnnotations++;
                annotationErrorMessage = "Ignoring record with HGVSp null classification '"
                        + annotatedRecord.getVARIANT_CLASSIFICATION() + "'";
            } else {
                annotationErrorMessage = "Failed to annotate variant";
            }
            failedAnnotations++;
        }
        if (!annotationErrorMessage.isEmpty()) {
            if (verbose)
                LOG.info(annotationErrorMessage + ": " + variantDetails);
            if (errorReportLocation != null)
                updateErrorMessages(record, annotatedRecord.getVARIANT_CLASSIFICATION(),
                        annotator.getUrlForRecord(record, isoformOverride), annotationErrorMessage);
        }
    }
    // print summary statistics and save error messages to file if applicable
    printSummaryStatistics(failedAnnotations, failedNullHgvspAnnotations, snpAndIndelVariants,
            failedServerAnnotations);
    if (errorReportLocation != null) {
        saveErrorMessagesToFile(errorMessages);
    }
    ec.put("mutation_header", new ArrayList(header));
}