本文整理汇总了Java中com.autonomy.aci.client.services.AciErrorException.setErrorDescription方法的典型用法代码示例。如果您正苦于以下问题:Java AciErrorException.setErrorDescription方法的具体用法?Java AciErrorException.setErrorDescription怎么用?Java AciErrorException.setErrorDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.autonomy.aci.client.services.AciErrorException
的用法示例。
在下文中一共展示了AciErrorException.setErrorDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkACIResponseForError
import com.autonomy.aci.client.services.AciErrorException; //导入方法依赖的package包/类
/**
* Checks the DOM <tt>Document</tt> to see if it is an ACI Server error response. If it is, it pulls all the
* information contained in the response into an <tt>AciErrorException</tt> and throws it, otherwise it does
* nothing.
* @param response The DOM <tt>Document</tt> to check.
* @throws AciErrorException If an error response was detected.
* @throws ProcessorException If there was any other kind of exception caught during processing.
*/
private void checkACIResponseForError(final Document response) {
LOGGER.trace("checkACIResponseForError() called...");
// Create an xpath object for getting stuff with...
final XPath xpath = XPathFactory.newInstance().newXPath();
try {
// Get the value of the <response> tag...
final String value = xpath.evaluate("/autnresponse/response", response);
LOGGER.debug("Response tag has value - {}...", value);
if ("ERROR".equals(value)) {
LOGGER.debug("Error response detected, creating an AciErrorException...");
// Create an exception to throw...
final AciErrorException error = new AciErrorException();
// Get the error properties...
error.setErrorId(xpath.evaluate("/autnresponse/responsedata/error/errorid", response));
error.setRawErrorId(xpath.evaluate("/autnresponse/responsedata/error/rawerrorid", response));
error.setErrorString(xpath.evaluate("/autnresponse/responsedata/error/errorstring", response));
error.setErrorDescription(xpath.evaluate("/autnresponse/responsedata/error/errordescription", response));
error.setErrorCode(xpath.evaluate("/autnresponse/responsedata/error/errorcode", response));
try {
error.setErrorTime(DateTimeUtils.getInstance().parseDate(xpath.evaluate("/autnresponse/responsedata/error/errortime", response), "dd MMM yy HH:mm:ss"));
} catch (final ParseException pe) {
LOGGER.error("ParseException caught while trying to convert errortime tag into java.util.Date.", pe);
}
// Throw the error...
throw error;
}
} catch (final XPathExpressionException xpee) {
// Throw a wobbler, as this should never happen...
throw new ProcessorException("XPathExpressionException caught while trying to check ACI response for ERROR flag.", xpee);
}
}
示例2: process
import com.autonomy.aci.client.services.AciErrorException; //导入方法依赖的package包/类
/**
* Process the ACI error response into an <tt>AciErrorException</tt>.
* @param aciResponse The ACI response to process
* @return Does not actually return anything as it throws the exception when it's finished parsing the response.
* @throws AciErrorException Unless there was an error
* @throws ProcessorException If an error occurred during the processing of the ACI response
*/
@Override
public AciErrorException process(final XMLStreamReader aciResponse) {
LOGGER.trace("process() called...");
try {
// Create the exception that we will throw...
final AciErrorException exception = new AciErrorException();
// We need to be able to handle both being given the full response and a partial response...
while (aciResponse.hasNext()) {
// Get the event type...
final int eventType = aciResponse.next();
// Get the errorid element and then process from there...
if (XMLEvent.START_ELEMENT == eventType) {
if ("errorid".equalsIgnoreCase(aciResponse.getLocalName())) {
exception.setErrorId(aciResponse.getElementText());
} else if ("rawerrorid".equalsIgnoreCase(aciResponse.getLocalName())) {
exception.setRawErrorId(aciResponse.getElementText());
} else if ("errorstring".equalsIgnoreCase(aciResponse.getLocalName())) {
exception.setErrorString(aciResponse.getElementText());
} else if ("errordescription".equalsIgnoreCase(aciResponse.getLocalName())) {
exception.setErrorDescription(aciResponse.getElementText());
} else if ("errorcode".equalsIgnoreCase(aciResponse.getLocalName())) {
exception.setErrorCode(aciResponse.getElementText());
} else if ("errortime".equalsIgnoreCase(aciResponse.getLocalName())) {
try {
exception.setErrorTime(DateTimeUtils.getInstance().parseDate(aciResponse.getElementText(), "dd MMM yy HH:mm:ss"));
} catch (final ParseException pe) {
LOGGER.error("ParseException caught while trying to convert the errortime element into a java.util.Date.", pe);
}
}
}
}
// Throw the generated exception...
throw exception;
} catch (final XMLStreamException xmlse) {
throw new ProcessorException("Unable to create an AciErrorException from the ACI response.", xmlse);
}
}