Search in sources :

Example 6 with ClusterConfigException

use of com.ctrip.framework.dal.cluster.client.exception.ClusterConfigException in project dal by ctripcorp.

the class ClusterConfigXMLParser method parse.

@Override
public ClusterConfig parse(InputStream stream, DalConfigCustomizedOption customizedOption) {
    try {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        Document doc = factory.newDocumentBuilder().parse(stream);
        return parse(doc, customizedOption);
    } catch (Throwable t) {
        throw new ClusterConfigException("parse cluster config error", t);
    }
}
Also used : ClusterConfigException(com.ctrip.framework.dal.cluster.client.exception.ClusterConfigException) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory)

Aggregations

ClusterConfigException (com.ctrip.framework.dal.cluster.client.exception.ClusterConfigException)6 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)2 ClusterType (com.ctrip.framework.dal.cluster.client.cluster.ClusterType)1 DatabaseCategory (com.ctrip.framework.dal.cluster.client.database.DatabaseCategory)1 DalRuntimeException (com.ctrip.platform.dal.exceptions.DalRuntimeException)1 StringReader (java.io.StringReader)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 InputSource (org.xml.sax.InputSource)1