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

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

Introduction

In this page you can find the example usage for org.springframework.web.client HttpClientErrorException 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:com.bcknds.demo.oauth2.security.ClientCredentialAuthenticationTests.java

/**
 * Test secure endpoint without authentication
 *//*  ww  w  . j av a  2  s.c o m*/
@Test
public void testSecureEndpointNoAuthentication() {
    RestTemplate restTemplate = new RestTemplate();
    try {
        restTemplate.getForEntity(SECURE_ENDPOINT, String.class);
        fail("Exception expected. None was thrown.");
    } catch (HttpClientErrorException ex) {
        assertEquals(ex.getStatusCode(), HttpStatus.UNAUTHORIZED);
    } catch (ResourceAccessException ex) {
        fail("It appears that the server may not be running. Please start it before running tests");
    } catch (Exception ex) {
        fail(ex.getMessage());
    }
}

From source file:com.bcknds.demo.oauth2.security.ClientCredentialAuthenticationTests.java

/**
 * Test authentication failure to method secure endpoint that requires only authentication
 * using no authentication/*from   w  ww  .  j  av  a2 s.c  o  m*/
 */
@Test
public void testClientCredentialsMethodNotLoggedIn() {
    RestTemplate restTemplate = new RestTemplate();
    try {
        restTemplate.getForEntity(METHOD_SECURE_ENDPOINT, String.class);
        fail("Expected exception. None was thrown.");
    } catch (HttpClientErrorException ex) {
        assertEquals(ex.getStatusCode(), HttpStatus.UNAUTHORIZED);
    } catch (ResourceAccessException ex) {
        fail("It appears that the server may not be running. Please start it before running tests");
    } catch (Exception ex) {
        fail(ex.getMessage());
    }
}

From source file:it.infn.mw.iam.authn.oidc.DefaultOidcTokenRequestor.java

@Override
public String requestTokens(OidcProviderConfiguration conf, MultiValueMap<String, String> tokenRequestParams) {

    RestOperations restTemplate = restTemplateFactory.newRestTemplate();

    try {//from  ww  w .  j a v  a 2  s  . com

        return restTemplate.postForObject(conf.serverConfig.getTokenEndpointUri(),
                prepareTokenRequest(conf, tokenRequestParams), String.class);

    } catch (HttpClientErrorException e) {

        if (e.getStatusCode() != null && e.getStatusCode().equals(BAD_REQUEST)) {
            parseErrorResponse(e).ifPresent(er -> {

                String errorMessage = String.format("Token request error: %s '%s'", er.getError(),
                        er.getErrorDescription());
                LOG.error(errorMessage);

                throw new OidcClientError(e.getMessage(), er.getError(), er.getErrorDescription(),
                        er.getErrorUri());

            });
        }

        String errorMessage = String.format("Token request error: %s", e.getMessage());
        LOG.error(errorMessage, e);
        throw new OidcClientError(errorMessage, e);
    } catch (Exception e) {
        String errorMessage = String.format("Token request error: %s", e.getMessage());
        LOG.error(errorMessage, e);
        throw new OidcClientError(errorMessage, e);
    }

}

From source file:org.alfresco.dropbox.webscripts.GetNode.java

private void syncUpdate(final NodeRef nodeRef, boolean useParent) {
    String currentUser = AuthenticationUtil.getRunAsUser();

    Map<String, NodeRef> syncedUsers = dropboxService.getSyncedUsers(nodeRef);

    if (useParent) {
        syncedUsers = filterMap(nodeRef);
    } else {//  w  ww  .j  av  a  2 s. c o  m
        syncedUsers = dropboxService.getSyncedUsers(nodeRef);
    }

    syncedUsers.remove(currentUser);

    for (String key : syncedUsers.keySet()) {
        AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() {
            public Object doWork() throws Exception {
                Metadata metadata = null;
                if (nodeService.getType(nodeRef).equals(ContentModel.TYPE_CONTENT)) {
                    metadata = dropboxService.putFile(nodeRef, true);
                    dropboxService.persistMetadata(metadata, nodeRef);
                } else if (nodeService.getType(nodeRef).equals(ContentModel.TYPE_FOLDER)) {
                    // If this is a folder, we need to try and create the
                    // folder in Dropbox for the user. If the folder already
                    // exists a 403 status error is returned, at which
                    // point, we get the metadata for the folder and then
                    // update the node with the metadata.
                    try {
                        metadata = dropboxService.createFolder(nodeRef);

                        logger.debug("Dropbox: Add: createFolder: " + nodeRef.toString());
                    } catch (HttpClientErrorException hcee) {
                        if (hcee.getStatusCode().ordinal() == Status.STATUS_FORBIDDEN) {
                            metadata = dropboxService.getMetadata(nodeRef);
                        } else {
                            throw new WebScriptException(hcee.getMessage());
                        }
                    }
                }

                if (metadata != null) {
                    dropboxService.persistMetadata(metadata, nodeRef);
                } else {
                    throw new WebScriptException(Status.STATUS_BAD_REQUEST,
                            "Dropbox metadata maybe out of sync for " + nodeRef);
                }

                return null;
            }
        }, key);
    }
}

From source file:org.venice.piazza.servicecontroller.messaging.ServiceMessageWorker.java

/**
 * Handles service job requests on a thread
 *///from w w w.  j a v  a 2s  .  c o  m
@Async
public Future<String> run(ConsumerRecord<String, String> consumerRecord, Producer<String, String> producer,
        Job job, WorkerCallback callback) {
    try {
        String handleUpdate = StatusUpdate.STATUS_SUCCESS;
        String handleTextUpdate = "";
        ResponseEntity<String> handleResult = null;
        boolean rasterJob = false;
        ObjectMapper mapper = makeNewObjectMapper();
        // if a jobType has been declared
        if (job != null) {
            try {
                PiazzaJobType jobType = job.getJobType();
                coreLogger.log("Job ID:" + job.getJobId(), PiazzaLogger.DEBUG);

                if (jobType instanceof ExecuteServiceJob) {
                    coreLogger.log("ExecuteServiceJob Detected", PiazzaLogger.DEBUG);

                    // Get the ResourceMetadata
                    ExecuteServiceJob jobItem = (ExecuteServiceJob) jobType;
                    ExecuteServiceData esData = jobItem.data;
                    if (esData.dataOutput != null) {
                        DataType dataType = esData.dataOutput.get(0);
                        if ((dataType != null) && (dataType instanceof RasterDataType)) {
                            // Call special method to call and send
                            rasterJob = true;
                            handleRasterType(jobItem, job, producer);
                        } else {
                            coreLogger.log("ExecuteServiceJob Original Way", PiazzaLogger.DEBUG);
                            handleResult = esHandler.handle(jobType);

                            coreLogger.log("Execution handled", PiazzaLogger.DEBUG);
                            handleResult = checkResult(handleResult);

                            coreLogger.log("Send Execute Status KAFKA", PiazzaLogger.DEBUG);
                            sendExecuteStatus(job, producer, handleUpdate, handleResult);
                        }
                    } else {
                        handleResult = new ResponseEntity<>(
                                "DataOuptut mimeType was not specified.  Please refer to the API for details.",
                                HttpStatus.BAD_REQUEST);
                    }

                }

            } catch (IOException ex) {
                coreLogger.log(ex.getMessage(), PiazzaLogger.ERROR);
                handleUpdate = StatusUpdate.STATUS_ERROR;
                handleTextUpdate = ex.getMessage();
            } catch (ResourceAccessException rex) {
                coreLogger.log(rex.getMessage(), PiazzaLogger.ERROR);
                handleTextUpdate = rex.getMessage();
                handleUpdate = StatusUpdate.STATUS_ERROR;
            } catch (HttpClientErrorException hex) {
                coreLogger.log(hex.getMessage(), PiazzaLogger.ERROR);
                handleUpdate = StatusUpdate.STATUS_ERROR;
                handleTextUpdate = hex.getMessage();
            }

            // if there was no result set then
            // use the default error messages set.
            if (!rasterJob) {
                if (handleResult == null) {

                    StatusUpdate su = new StatusUpdate();
                    su.setStatus(handleUpdate);
                    // Create a text result and update status
                    ErrorResult errorResult = new ErrorResult();
                    errorResult.setMessage(handleTextUpdate);

                    su.setResult(errorResult);

                    ProducerRecord<String, String> prodRecord = new ProducerRecord<String, String>(
                            String.format("%s-%s", JobMessageFactory.UPDATE_JOB_TOPIC_NAME, SPACE),
                            job.getJobId(), mapper.writeValueAsString(su));
                    producer.send(prodRecord);
                } else {
                    // If the status is not ok and the job is not equal to null
                    // then send an update to the job manager that there was some failure
                    boolean eResult = (handleResult.getStatusCode() != HttpStatus.OK) ? true : false;
                    if (eResult) {
                        handleUpdate = StatusUpdate.STATUS_FAIL;

                        handleResult = checkResult(handleResult);

                        String serviceControlString = mapper.writeValueAsString(handleResult);

                        StatusUpdate su = new StatusUpdate();
                        su.setStatus(handleUpdate);
                        // Create a text result and update status
                        ErrorResult errorResult = new ErrorResult();
                        errorResult.setMessage(serviceControlString);
                        su.setResult(errorResult);

                        ProducerRecord<String, String> prodRecord = new ProducerRecord<String, String>(
                                String.format("%s-%s", JobMessageFactory.UPDATE_JOB_TOPIC_NAME, SPACE),
                                job.getJobId(), mapper.writeValueAsString(su));
                        producer.send(prodRecord);
                    } // if there is a result

                }
            } // If a raster job was not done
        }
        // the job sent in was null so log an error
        else
            coreLogger.log("The job sent in was a null job", PiazzaLogger.ERROR);
    } catch (WakeupException ex) {
        coreLogger.log(ex.getMessage(), PiazzaLogger.ERROR);
    } catch (JsonProcessingException ex) {
        coreLogger.log(ex.getMessage(), PiazzaLogger.ERROR);
    }

    return new AsyncResult<String>("ServiceMessageWorker_Thread");
}

From source file:eu.freme.broker.eservices.FremeNER.java

private ResponseEntity<String> callBackend(String uri, HttpMethod method, String body) {

    RestTemplate restTemplate = new RestTemplate();
    try {/*from ww w .j a  v a  2s  .  com*/
        if (body == null) {
            return restTemplate.exchange(new URI(uri), method, null, String.class);
        } else {
            ResponseEntity<String> response = restTemplate.exchange(new URI(uri), method,
                    new HttpEntity<String>(body), String.class);

            if (response.getStatusCode() == HttpStatus.CONFLICT) {
                throw new eu.freme.broker.exception.BadRequestException(
                        "Dataset with this name already existis and it cannot be created.");
            } else {
                return response;
            }
            //                return restTemplate.exchange(new URI(uri), method, new HttpEntity<String>(body), String.class);
        }
    } catch (HttpClientErrorException rce) {
        if (rce.getStatusCode() == HttpStatus.CONFLICT) {
            throw new eu.freme.broker.exception.BadRequestException(
                    "Dataset with this name already existis and it cannot be created.");
        } else {
            throw new eu.freme.broker.exception.ExternalServiceFailedException(rce.getMessage());
        }
    } catch (RestClientException rce) {
        logger.error("failed", rce);
        throw new eu.freme.broker.exception.ExternalServiceFailedException(rce.getMessage());
    } catch (Exception e) {
        logger.error("failed", e);
        return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

From source file:com.daon.identityx.controller.SimpleController.java

/**
 * The a web method throws an exception with a http status, then we controller will pass this detail
 * back to the client./*from ww  w.j  a  v  a 2s  . c o m*/
 * 
 * @param ex
 * @return
 */
@ExceptionHandler(HttpClientErrorException.class)
@ResponseBody
public Error handleHttpExceptions(HttpClientErrorException ex, HttpServletResponse response) {
    logger.error("An unexpected exception occurred while attempting to process the request. Exception: "
            + ex.getMessage());
    response.setStatus(ex.getStatusCode().value());
    return new Error(ex.getStatusCode().value(), ex.getStatusText());
}

From source file:org.mitre.openid.connect.client.AbstractOIDCAuthenticationFilter.java

/**
 * Handles the authorization grant response
 * /*from   w w  w  .  j av a 2 s. c  om*/
 * @param authorizationGrant
 *            The Authorization grant code
 * @param request
 *            The request from which to extract parameters and perform the
 *            authentication
 * @return The authenticated user token, or null if authentication is
 *         incomplete.
 * @throws Exception 
 * @throws UnsupportedEncodingException
 */
protected Authentication handleAuthorizationGrantResponse(String authorizationGrant, HttpServletRequest request,
        OIDCServerConfiguration serverConfig) {

    final boolean debug = logger.isDebugEnabled();

    // Handle Token Endpoint interaction
    HttpClient httpClient = new DefaultHttpClient();

    httpClient.getParams().setParameter("http.socket.timeout", new Integer(httpSocketTimeout));

    //
    // TODO: basic auth is untested (it wasn't working last I
    // tested)
    // UsernamePasswordCredentials credentials = new
    // UsernamePasswordCredentials(serverConfig.getClientId(),
    // serverConfig.getClientSecret());
    // ((DefaultHttpClient)
    // httpClient).getCredentialsProvider().setCredentials(AuthScope.ANY,
    // credentials);
    //

    HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient);

    RestTemplate restTemplate = new RestTemplate(factory);

    MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
    form.add("grant_type", "authorization_code");
    form.add("code", authorizationGrant);
    form.add("redirect_uri", AbstractOIDCAuthenticationFilter.buildRedirectURI(request, null));

    // pass clientId and clientSecret in post of request
    form.add("client_id", serverConfig.getClientId());
    form.add("client_secret", serverConfig.getClientSecret());

    if (debug) {
        logger.debug("tokenEndpointURI = " + serverConfig.getTokenEndpointURI());
        logger.debug("form = " + form);
    }
    ;
    String jsonString = null;

    try {
        jsonString = restTemplate.postForObject(serverConfig.getTokenEndpointURI(), form, String.class);
    } catch (HttpClientErrorException httpClientErrorException) {

        // Handle error

        logger.error("Token Endpoint error response:  " + httpClientErrorException.getStatusText() + " : "
                + httpClientErrorException.getMessage());

        throw new AuthenticationServiceException("Unable to obtain Access Token.");
    }

    logger.debug("from TokenEndpoint jsonString = " + jsonString);

    JsonElement jsonRoot = new JsonParser().parse(jsonString);

    if (jsonRoot.getAsJsonObject().get("error") != null) {

        // Handle error

        String error = jsonRoot.getAsJsonObject().get("error").getAsString();

        logger.error("Token Endpoint returned: " + error);

        throw new AuthenticationServiceException(
                "Unable to obtain Access Token.  Token Endpoint returned: " + error);

    } else {

        // Extract the id_token to insert into the
        // OpenIdConnectAuthenticationToken

        IdToken idToken = null;
        JwtSigningAndValidationService jwtValidator = getValidatorForServer(serverConfig);

        if (jsonRoot.getAsJsonObject().get("id_token") != null) {

            try {
                idToken = IdToken.parse(jsonRoot.getAsJsonObject().get("id_token").getAsString());

            } catch (AuthenticationServiceException e) {

                // I suspect this could happen

                logger.error("Problem parsing id_token:  " + e);
                // e.printStackTrace();

                throw new AuthenticationServiceException(
                        "Problem parsing id_token return from Token endpoint: " + e);
            }

            if (jwtValidator
                    .validateSignature(jsonRoot.getAsJsonObject().get("id_token").getAsString()) == false) {
                throw new AuthenticationServiceException("Signature not validated");
            }
            if (idToken.getClaims().getIssuer() == null) {
                throw new AuthenticationServiceException("Issuer is null");
            }
            if (!idToken.getClaims().getIssuer().equals(serverConfig.getIssuer())) {
                throw new AuthenticationServiceException("Issuers do not match");
            }
            if (jwtValidator.isJwtExpired(idToken)) {
                throw new AuthenticationServiceException("Id Token is expired");
            }
            if (jwtValidator.validateIssuedAt(idToken) == false) {
                throw new AuthenticationServiceException("Id Token issuedAt failed");
            }

        } else {

            // An error is unlikely, but it good security to check

            logger.error("Token Endpoint did not return an id_token");

            throw new AuthenticationServiceException("Token Endpoint did not return an id_token");
        }

        // Clients are required to compare nonce claim in ID token to 
        // the nonce sent in the Authorization request.  The client 
        // stores this value as a signed session cookie to detect a 
        // replay by third parties.
        //
        // See: OpenID Connect Messages Section 2.1.1 entitled "ID Token"
        //
        // http://openid.net/specs/openid-connect-messages-1_0.html#id_token
        //

        //String nonce = idToken.getClaims().getClaimAsString("nonce");

        String nonce = idToken.getClaims().getNonce();

        if (StringUtils.isBlank(nonce)) {

            logger.error("ID token did not contain a nonce claim.");

            throw new AuthenticationServiceException("ID token did not contain a nonce claim.");
        }

        Cookie nonceSignatureCookie = WebUtils.getCookie(request, NONCE_SIGNATURE_COOKIE_NAME);

        if (nonceSignatureCookie != null) {

            String sigText = nonceSignatureCookie.getValue();

            if (sigText != null && !sigText.isEmpty()) {

                if (!verify(signer, publicKey, nonce, sigText)) {
                    logger.error("Possible replay attack detected! "
                            + "The comparison of the nonce in the returned " + "ID Token to the signed session "
                            + NONCE_SIGNATURE_COOKIE_NAME + " failed.");

                    throw new AuthenticationServiceException("Possible replay attack detected! "
                            + "The comparison of the nonce in the returned " + "ID Token to the signed session "
                            + NONCE_SIGNATURE_COOKIE_NAME + " failed.");
                }
            } else {
                logger.error(NONCE_SIGNATURE_COOKIE_NAME + " cookie was found but value was null or empty");
                throw new AuthenticationServiceException(
                        NONCE_SIGNATURE_COOKIE_NAME + " cookie was found but value was null or empty");
            }

        } else {

            logger.error(NONCE_SIGNATURE_COOKIE_NAME + " cookie was not found.");

            throw new AuthenticationServiceException(NONCE_SIGNATURE_COOKIE_NAME + " cookie was not found.");
        }

        // pull the user_id out as a claim on the id_token

        String userId = idToken.getTokenClaims().getUserId();

        // construct an OpenIdConnectAuthenticationToken and return 
        // a Authentication object w/the userId and the idToken

        OpenIdConnectAuthenticationToken token = new OpenIdConnectAuthenticationToken(userId, idToken);

        Authentication authentication = this.getAuthenticationManager().authenticate(token);

        return authentication;

    }
}

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

private void orderRequestDownload(final MarketplaceStoreModel model) {
    if (null == model.getRequestStartTime()) {
        NotificationUtils//from ww  w . j  a v a2  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, "");
}