【发布时间】:2016-04-07 03:41:52
【问题描述】:
我想返回我自己的自定义错误消息,在验证请求时需要原始错误消息中的信息。我使用这个@SchemvaValidation 来自定义它。
public class MyErrorHandler extends ValidationErrorHandler {
private final static Logger logger = Logger.getLogger(LoggingHandler.class);
public void warning(SAXParseException exception) throws SAXException {
logger.warn("warning", exception);
}
public static String message = "";
public void error(SAXParseException exception) throws SAXException {
logger.error("error", exception);
message += exception.getMessage();
throw new SAXParseException("my custom" + exception.getMessage(),null);
}
public void fatalError(SAXParseException exception) throws SAXException {
logger.fatal("fatal error", exception);
throw new SAXParseException("my custom" + exception.getMessage(),null);
}
}
问题是如果我抛出我自己的消息,其他错误将被忽略,如果我不这样做,它会在我的 Web 方法之前抛出它自己的异常。你有什么解决办法吗?
【问题讨论】:
标签: java web-services jaxb jax-ws