/** * Creates and initializes a BatchInterrupted object. * * @param cause exception that caused batch processing to stop * @param totalCount number of entries parsed so far, note that * it is to be expected that {@code totalCount >= successCount + errorCount} * @param successCount number of entries processed successfully so far * @param errorCount number of entries rejected so far */ public BatchInterrupted(Throwable cause, int totalCount, int successCount, int errorCount) { this(getReasonFromException(cause), totalCount, successCount, errorCount); if (cause instanceof ServiceException) { ServiceException se = (ServiceException)cause; content = se.getResponseBody(); contentType = se.getResponseContentType(); } }
/** * Creates and initializes a BatchInterrupted object. * * @param cause exception that caused batch processing to stop * @param totalCount number of entries parsed so far, note that * it is to be expected that {@code totalCount >= successCount + errorCount} * @param successCount number of entries processed successfully so far * @param errorCount number of entries rejected so far */ public BatchInterrupted(Throwable cause, int totalCount, int successCount, int errorCount) { this(getReasonFromException(cause), totalCount, successCount, errorCount); if (cause instanceof ServiceException) { ServiceException se = (ServiceException)cause; content = se.getResponseBody(); contentType = se.getResponseContentType(); } }
/** * Creates and initializes a BatchInterrupted object. * * @param cause exception that caused batch processing to stop * @param totalCount number of entries parsed so far, note that * it is to be expected that {@code totalCount >= successCount + errorCount} * @param successCount number of entries processed successfully so far * @param errorCount number of entries rejected so far */ public BatchInterrupted(Throwable cause, int totalCount, int successCount, int errorCount) { this(getReasonFromException(cause), totalCount, successCount, errorCount); if (cause instanceof ServiceException) { ServiceException se = (ServiceException)cause; content = se.getResponseBody(); contentType = se.getResponseContentType(); } }
/** * Creates a BatchStatus and initializes it * based on an exception. * * @param e */ public BatchStatus(ServiceException e) { code = e.getHttpErrorCodeOverride(); if (code == -1) { code = HttpURLConnection.HTTP_INTERNAL_ERROR; } reason = e.getMessage(); contentType = e.getResponseContentType(); content = e.getResponseBody(); }
/** * Extracts errors from a {@link ServiceException}. * * @param e the ServiceException to be parsed */ public void addErrors(ServiceException e) { addErrors(e.getMessage(), e.getResponseContentType(), e.getResponseBody()); }
/** * Extracts errors from a {@link ServiceException}. * * @param e the ServiceException to be parsed */ public void addErrors(ServiceException e) { addErrors(e.getMessage(), e.getResponseContentType(), e.getResponseBody()); }
(se.getResponseBody() == null)) { return null; && (se.getResponseBody().contains("AppsForYourDomainErrors"))) { try { DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(new InputSource( new StringReader(se.getResponseBody()))); Element root = document.getDocumentElement(); NodeList errorList = root.getElementsByTagName("error");
/** * Add a <strong>Throwable</strong> to a message context, the message from the throwable is embedded as * the Synapse contstant ERROR_MESSAGE. * * @param ctxt Synapse Message Context to which the error tags need to be added * @param throwable Throwable that needs to be parsed and added * @param errorCode integer type error code to be added to ERROR_CODE Synapse constant */ protected final void storeErrorResponseStatus(final MessageContext ctxt, final Throwable throwable, final int errorCode) { if (throwable instanceof ServiceException) { ctxt.setProperty(SynapseConstants.ERROR_DETAIL, ((ServiceException) throwable).getResponseBody()); } ctxt.setProperty(SynapseConstants.ERROR_CODE, errorCode); ctxt.setProperty(SynapseConstants.ERROR_MESSAGE, throwable.getMessage()); ctxt.setFaultResponse(true); }
(se.getResponseBody() == null)) { return null; && (se.getResponseBody().contains("AppsForYourDomainErrors"))) { try { DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(new InputSource( new StringReader(se.getResponseBody()))); Element root = document.getDocumentElement(); NodeList errorList = root.getElementsByTagName("error");
/** * Creates a BatchStatus and initializes it * based on an exception. * * @param e */ public BatchStatus(ServiceException e) { code = e.getHttpErrorCodeOverride(); if (code == -1) { code = HttpURLConnection.HTTP_INTERNAL_ERROR; } reason = e.getMessage(); contentType = e.getResponseContentType(); content = e.getResponseBody(); }
/** * Creates a BatchStatus and initializes it * based on an exception. * * @param e */ public BatchStatus(ServiceException e) { code = e.getHttpErrorCodeOverride(); if (code == -1) { code = HttpURLConnection.HTTP_INTERNAL_ERROR; } reason = e.getMessage(); contentType = e.getResponseContentType(); content = e.getResponseBody(); }
/** * Creates and initializes a BatchInterrupted object. * * @param cause exception that caused batch processing to stop * @param totalCount number of entries parsed so far, note that * it is to be expected that {@code totalCount >= successCount + errorCount} * @param successCount number of entries processed successfully so far * @param errorCount number of entries rejected so far */ public BatchInterrupted(Throwable cause, int totalCount, int successCount, int errorCount) { this(getReasonFromException(cause), totalCount, successCount, errorCount); if (cause instanceof ServiceException) { ServiceException se = (ServiceException)cause; setContent(se.getResponseBody()); setContentType(se.getResponseContentType()); } }
/** * Creates and initializes a BatchInterrupted object. * * @param cause exception that caused batch processing to stop * @param totalCount number of entries parsed so far, note that * it is to be expected that {@code totalCount >= successCount + errorCount} * @param successCount number of entries processed successfully so far * @param errorCount number of entries rejected so far */ public BatchInterrupted(Throwable cause, int totalCount, int successCount, int errorCount) { this(getReasonFromException(cause), totalCount, successCount, errorCount); if (cause instanceof ServiceException) { ServiceException se = (ServiceException)cause; setContent(se.getResponseBody()); setContentType(se.getResponseContentType()); } }
/** * Creates and initializes a BatchInterrupted object. * * @param cause exception that caused batch processing to stop * @param totalCount number of entries parsed so far, note that * it is to be expected that {@code totalCount >= successCount + errorCount} * @param successCount number of entries processed successfully so far * @param errorCount number of entries rejected so far */ public BatchInterrupted(Throwable cause, int totalCount, int successCount, int errorCount) { this(getReasonFromException(cause), totalCount, successCount, errorCount); if (cause instanceof ServiceException) { ServiceException se = (ServiceException)cause; setContent(se.getResponseBody()); setContentType(se.getResponseContentType()); } }
/** * Creates a BatchStatus and initializes it * based on an exception. * * @param e exception to initialize the status from */ public BatchStatus(ServiceException e) { this(); int code = e.getHttpErrorCodeOverride(); if (code == -1) { code = HttpURLConnection.HTTP_INTERNAL_ERROR; } setCode(code); setReason(e.getMessage()); setContentType(e.getResponseContentType()); setContent(e.getResponseBody()); }
/** * Creates a BatchStatus and initializes it * based on an exception. * * @param e exception to initialize the status from */ public BatchStatus(ServiceException e) { this(); int code = e.getHttpErrorCodeOverride(); if (code == -1) { code = HttpURLConnection.HTTP_INTERNAL_ERROR; } setCode(code); setReason(e.getMessage()); setContentType(e.getResponseContentType()); setContent(e.getResponseBody()); }
/** * Creates a BatchStatus and initializes it * based on an exception. * * @param e exception to initialize the status from */ public BatchStatus(ServiceException e) { this(); int code = e.getHttpErrorCodeOverride(); if (code == -1) { code = HttpURLConnection.HTTP_INTERNAL_ERROR; } setCode(code); setReason(e.getMessage()); setContentType(e.getResponseContentType()); setContent(e.getResponseBody()); }