BaseStreamWriter.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:woodstox 作者:
@Override
public void reportProblem(XMLValidationProblem prob)
    throws XMLStreamException
{
    // Custom handler set? If so, it'll take care of it:
    if (mVldProbHandler != null) {
        mVldProbHandler.reportProblem(prob);
        return;
    }

    /* For now let's implement basic functionality: warnings get
     * reported via XMLReporter, errors and fatal errors result in
     * immediate exceptions.
     */
    /* 27-May-2008, TSa: [WSTX-153] Above is incorrect: as per Stax
     *   javadocs for XMLReporter, both warnings and non-fatal errors
     *   (which includes all validation errors) should be reported via
     *   XMLReporter interface, and only fatals should cause an
     *   immediate stream exception (by-passing reporter)
     */
    if (prob.getSeverity() > XMLValidationProblem.SEVERITY_ERROR) {
        throw WstxValidationException.create(prob);
    }
    XMLReporter rep = mConfig.getProblemReporter();
    if (rep != null) {
        doReportProblem(rep, prob);
    } else {
        /* If no reporter, regular non-fatal errors are to be reported
         * as exceptions as well, for backwards compatibility
         */
        if (prob.getSeverity() >= XMLValidationProblem.SEVERITY_ERROR) {
            throw WstxValidationException.create(prob);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号