InstanceCreator.java 文件源码

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

项目:org.alloytools.alloy 作者:
public InstanceCreator(InputStream in) {
    try {
        this.relations = new HashMap<Relation,Set<List<String>>>();
        this.atoms = new LinkedHashSet<String>();

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        this.document = builder.parse(in);
    } catch (SAXException sxe) {
        // Error generated during parsing
        Exception x = sxe;
        if (sxe.getException() != null)
            x = sxe.getException();
        throw new InstanceCreationException("Error generated during parsing: " + x.getMessage());

    } catch (ParserConfigurationException pce) {
        // Parser with specified options can't be built
        throw new InstanceCreationException("Parser with specified options cannot be built: " + pce.getMessage());

    } catch (IOException ioe) {
        // I/O error
        throw new InstanceCreationException("I/O error: " + ioe.getMessage());
    } finally {
        try {
            in.close();
        } catch (IOException e) {
            // ignore
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号