当前位置: 首页>>代码示例>>Java>>正文


Java SAXException.initCause方法代码示例

本文整理汇总了Java中org.xml.sax.SAXException.initCause方法的典型用法代码示例。如果您正苦于以下问题:Java SAXException.initCause方法的具体用法?Java SAXException.initCause怎么用?Java SAXException.initCause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xml.sax.SAXException的用法示例。


在下文中一共展示了SAXException.initCause方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: log

import org.xml.sax.SAXException; //导入方法依赖的package包/类
private SAXException log(String errorType, SAXParseException e) {
    Level level;
    String message;
    
    if (file == null) {
        level = Level.FINE;
        message = "XML parser " + errorType;
    } else {
        if (isModuleFile()) { //NOI18N
            level = Level.WARNING; // warnings for module layer supplied files
        } else {
            level = Level.FINE; // user files, can be from previous versions
        }

        message = "XML parser " + errorType + " in file " + file.getPath();
    }
    
    SAXException saxe = new SAXException(message);
    saxe.initCause(e);
    LOG.log(level, message, saxe); //NOI18N
    
    return saxe;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:StorageReader.java

示例2: endElement

import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Override
public void endElement(String namespaceURI, String localeName,
        String tagName) throws SAXException {
    Command cmd = stack.pop();
    // cmd.setTabCount(tabCount);

    // find if command works in context
    if (!stack.isEmpty()) {
        Command ctx = stack.peek();
        ctx.addChild(cmd);
    }

    // upper level commands
    if (stack.size() == 1 && cmd.isExecutable()) {
        commands.add(cmd);
    }

    // store reference to command
    if (cmd.hasAttr("id")) { //$NON-NLS-1$
        references.put(cmd.getAttr("id"), cmd); //$NON-NLS-1$
    }

    try {
        cmd.exec(references);
    } catch (Exception e) {
        SAXException e2 = new SAXException(e.getMessage());
        
        e2.initCause(e);
        throw e2;
    }

    if (--tabCount < 0) {
        tabCount = 0;
    }

    Command.prn(tabCount, tabCount + ">...<" + tagName + "> end"); //$NON-NLS-1$ //$NON-NLS-2$
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:38,代码来源:Handler.java

示例3: startElement

import org.xml.sax.SAXException; //导入方法依赖的package包/类
public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
    try {
        if (state == State.DESCRIPTION) {
            // make sure we don't interpret any tag while in description tag
            descriptionStarted(qName, attributes);
        } else if ("ivy-module".equals(qName)) {
            ivyModuleStarted(attributes);
        } else if ("info".equals(qName)) {
            infoStarted(attributes);
        } else if (state == State.INFO && "extends".equals(qName)) {
            extendsStarted(attributes);
        } else if (state == State.INFO && "license".equals(qName)) {
            getMd().addLicense(new License(substitute(attributes.getValue("name")), substitute(attributes.getValue("url"))));
        } else if (state == State.INFO && "ivyauthor".equals(qName)) {
            // nothing to do, we don't store this
            return;
        } else if (state == State.INFO && "repository".equals(qName)) {
            // nothing to do, we don't store this
            return;
        } else if (state == State.INFO && "description".equals(qName)) {
            getMd().setHomePage(substitute(attributes.getValue("homepage")));
            state = State.DESCRIPTION;
            buffer = new StringBuffer();
        } else if (state == State.INFO && isOtherNamespace(qName)) {
            buffer = new StringBuffer();
            state = State.EXTRA_INFO;
        } else if ("configurations".equals(qName)) {
            configurationStarted(attributes);
        } else if ("publications".equals(qName)) {
            publicationsStarted(attributes);
        } else if ("dependencies".equals(qName)) {
            dependenciesStarted(attributes);
        } else if ("conflicts".equals(qName)) {
            state = State.CONFLICT;
            maybeAddDefaultConfiguration();
        } else if ("artifact".equals(qName)) {
            artifactStarted(qName, attributes);
        } else if ("include".equals(qName) && state == State.DEP) {
            addIncludeRule(qName, attributes);
        } else if ("exclude".equals(qName) && state == State.DEP) {
            addExcludeRule(qName, attributes);
        } else if ("exclude".equals(qName) && state == State.DEPS) {
            state = State.EXCLUDE;
            parseRule(qName, attributes);
            getMd().addExcludeRule((ExcludeRule) confAware);
        } else if ("dependency".equals(qName)) {
            dependencyStarted(attributes);
        } else if ("conf".equals(qName)) {
            confStarted(attributes);
        } else if ("mapped".equals(qName)) {
            dd.addDependencyConfiguration(conf, substitute(attributes.getValue("name")));
        } else if (("conflict".equals(qName) && state == State.DEPS) || "manager".equals(qName) && state == State.CONFLICT) {
            LOGGER.debug("Ivy.xml conflict managers are not supported by Gradle. Ignoring conflict manager declared in {}", getResource().getDisplayName());
        } else if ("override".equals(qName) && state == State.DEPS) {
            LOGGER.debug("Ivy.xml dependency overrides are not supported by Gradle. Ignoring override declared in {}", getResource().getDisplayName());
        } else if ("include".equals(qName) && state == State.CONF) {
            includeConfStarted(attributes);
        } else if (validate && state != State.EXTRA_INFO && state != State.DESCRIPTION) {
            addError("unknown tag " + qName);
        }
    } catch (Exception ex) {
        if (ex instanceof SAXException) {
            throw (SAXException) ex;
        }
        SAXException sax = new SAXException("Problem occurred while parsing ivy file: "
                + ex.getMessage(), ex);
        sax.initCause(ex);
        throw sax;
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:72,代码来源:IvyXmlModuleDescriptorParser.java


注:本文中的org.xml.sax.SAXException.initCause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。