Example usage for org.xml.sax SAXException getMessage

List of usage examples for org.xml.sax SAXException getMessage

Introduction

In this page you can find the example usage for org.xml.sax SAXException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Return a detail message for this exception.

Usage

From source file:org.sakaiproject.webservices.TestsAndQuizzes.java

/** 
 * createAsessmentFromExportFile - WS Endpoint, exposing the SamLite createImportedAssessment()
 *
 * @param   String sessionid      the id of a valid admin session
 * @param   String siteid         the enterprise/sakai id of the site to be archived
 * @param   String siteproperty      the property that holds the enterprise site id
 * @param   String xmlfile         path to the IMS QTI document containing the assessment
 * @return   boolean                    returns true if assessment created successfully, false if assessment is null
 * /*from  ww  w  .j  av  a2 s  .  c  om*/
 * @throws   AxisFault         WS TestsAndQuizzes.createAssessmentFromXml(): XmlUtil.createDocument() returned a null QTI Document
 *                   WS TestsAndQuizzes.createAssessmentFromXml(): XmlUtil.createDocument() ParserConfigurationException: 
 *                  WS TestsAndQuizzes.createAssessmentFromXml(): XmlUtil.createDocument() SaxException:
 *                  WS TestsAndQuizzes.createAssessmentFromXml(): XmlUtil.createDocument() IOException: 
 *
 */

@WebMethod
@Path("/createAssessmentFromExportFile")
@Produces("text/plain")
@GET
public boolean createAssessmentFromExportFile(
        @WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid,
        @WebParam(name = "siteid", partName = "siteid") @QueryParam("siteid") String siteid,
        @WebParam(name = "siteproperty", partName = "siteproperty") @QueryParam("siteproperty") String siteproperty,
        @WebParam(name = "xmlfile", partName = "xmlfile") @QueryParam("xmlfile") String xmlfile) {
    Session session = establishSession(sessionid);
    Document document = null;

    try {
        document = XmlUtil.readDocument(xmlfile, true);
    } catch (ParserConfigurationException pce) {
        LOG.error(
                "WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() ParserConfigurationException: "
                        + pce.getMessage(),
                pce);
        throw new RuntimeException(
                "WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() ParserConfigurationException: "
                        + pce.getMessage());
    } catch (SAXException saxe) {
        LOG.error("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() SaxException: "
                + saxe.getMessage(), saxe);
        throw new RuntimeException(
                "WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() SaxException: "
                        + saxe.getMessage());
    } catch (IOException ioe) {
        LOG.error("WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() IOException: "
                + ioe.getMessage(), ioe);
        throw new RuntimeException(
                "WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() IOException: "
                        + ioe.getMessage());
    }
    if (document == null) {
        throw new RuntimeException(
                "WS TestsAndQuizzes.createAssessmentFromExportFile(): XmlUtil.createDocument() returned a null QTI Document");
    }

    return createAssessment(siteid, siteproperty, null, null, null, document);
}

From source file:org.slc.sli.ingestion.parser.impl.EdfiRecordParserImpl2.java

private void parseAndValidate(InputStream input, Schema schema) throws XmlParseException, IOException {
    ValidatorHandler vHandler = schema.newValidatorHandler();
    vHandler.setContentHandler(this);
    vHandler.setErrorHandler(this);

    InputSource is = new InputSource(new InputStreamReader(input, "UTF-8"));
    is.setEncoding("UTF-8");

    try {/*from w w  w  .  j  av  a 2  s .  c o m*/
        XMLReader parser = XMLReaderFactory.createXMLReader();
        parser.setContentHandler(vHandler);
        parser.setErrorHandler(this);

        vHandler.setFeature("http://apache.org/xml/features/continue-after-fatal-error", false);

        parser.setFeature("http://apache.org/xml/features/validation/id-idref-checking", false);
        parser.setFeature("http://apache.org/xml/features/continue-after-fatal-error", false);
        parser.setFeature("http://xml.org/sax/features/external-general-entities", false);
        parser.setFeature("http://xml.org/sax/features/external-parameter-entities", false);

        parser.parse(is);
    } catch (SAXException e) {
        throw new XmlParseException(e.getMessage(), e);
    }
}

From source file:org.sonar.plugins.xml.checks.XmlSchemaCheck.java

private void validate(String[] schemaList) {

    // Create a new validator
    Validator validator = createSchema(schemaList).newValidator();
    setFeature(validator, Constants.XERCES_FEATURE_PREFIX + "continue-after-fatal-error", true);
    validator.setErrorHandler(new MessageHandler());
    validator.setResourceResolver(new SchemaResolver());

    // Validate and catch the exceptions. MessageHandler will receive the errors and warnings.
    try {/*w w  w .j  av  a  2  s  .c o m*/
        LOG.info("Validate " + getWebSourceCode() + " with schema " + StringUtils.join(schemaList, ","));
        validator.validate(new StreamSource(getWebSourceCode().createInputStream()));
    } catch (SAXException e) {
        if (!containsMessage(e)) {
            createViolation(0, e.getMessage());
        }
    } catch (IOException e) {
        throw new SonarException(e);
    } catch (UnrecoverableParseError e) {
        // ignore, message already reported.
    }
}

From source file:org.uimafit.factory.JCasFactory.java

/**
 * This method takes a JCas, resets it, and loads it with the contents of an XMI or XCAS input
 * stream/*from   www. ja  v  a2 s. c  o  m*/
 *
 * @param xmlInputStream
 *            should contain the contents of a serialized CAS in the form of XMI or XCAS XML
 * @param isXmi
 *            if true, than assume XMI format. Otherwise, assume XCAS.
 */
public static void loadJCas(JCas jCas, InputStream xmlInputStream, boolean isXmi) throws IOException {
    jCas.reset();
    try {
        CAS cas = jCas.getCas();
        if (isXmi) {
            XmiCasDeserializer.deserialize(xmlInputStream, cas);
        } else {
            XCASDeserializer.deserialize(xmlInputStream, cas);
        }
    } catch (SAXException e) {
        IOException ioe = new IOException(e.getMessage());
        ioe.initCause(e);
        throw ioe; // NOPMD
        // If we were using Java 1.6 and add the wrapped exception to the IOException
        // constructor, we would not get a warning here
    } finally {
        IOUtils.closeQuietly(xmlInputStream);
    }
}

From source file:org.unigram.docvalidator.ConfigurationLoader.java

protected static Document parseConfigurationString(InputStream input) {
    DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
    Document doc = null;/*from  ww w  .  ja  v a2s  . co  m*/
    try {
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        dBuilder.setErrorHandler(new SAXErrorHandler());
        doc = dBuilder.parse(input);
    } catch (SAXException e) {
        LOG.error(e.getMessage());
    } catch (IOException e) {
        LOG.error(e.getMessage());
    } catch (ParserConfigurationException e) {
        LOG.error(e.getMessage());
    } catch (Throwable e) {
        LOG.error(e.getMessage());
    }
    return doc;
}

From source file:org.vfny.geoserver.config.web.tiles.definition.MultipleDefinitionsFactory.java

/**
 * Parse specified xml file and add definition to specified definitions set.
 * This method is used to load several description files in one instances list.
 * If filename exists and definition set is <code>null</code>, create a new set. Otherwise, return
 * passed definition set (can be <code>null</code>).
 * @param servletContext Current servlet context. Used to open file.
 * @param filename Name of file to parse.
 * @param xmlDefinitions Definitions set to which definitions will be added. If null, a definitions
 * set is created on request.//from  w w  w  .j  a v a2 s . c  o  m
 * @return XmlDefinitionsSet The definitions set created or passed as parameter.
 * @throws DefinitionsFactoryException On errors parsing file.
 */
private XmlDefinitionsSet parseXmlFile(ServletContext servletContext, String filename,
        XmlDefinitionsSet xmlDefinitions) throws DefinitionsFactoryException {
    try {
        /*InputStream input = servletContext.getResourceAsStream(filename);*/
        InputStream input = null;
        Resource[] resources = WebApplicationContextUtils.getWebApplicationContext(servletContext)
                .getResources(filename);
        final int length = resources.length;

        for (int i = 0; i < length; i++) {
            try {
                input = resources[i].getURL().openStream(); /*getServletContext().getResource(path)*/
            } catch (IOException e) {
                //error loading from this resource.  Probably it doesn't exist.
                if (log.isDebugEnabled()) {
                    log.debug("", e);
                }

                return xmlDefinitions;
            }

            // Try to load using real path.
            // This allow to load config file under websphere 3.5.x
            // Patch proposed Houston, Stephen (LIT) on 5 Apr 2002
            if (null == input) {
                try {
                    input = new java.io.FileInputStream(servletContext.getRealPath(filename));
                } catch (Exception e) {
                }
            }

            // If still nothing found, this mean no config file is associated
            if (input == null) {
                if (log.isDebugEnabled()) {
                    log.debug("Can't open file '" + filename + "'");
                }

                return xmlDefinitions;
            }

            // Check if parser already exist.
            // Doesn't seem to work yet.
            //if( xmlParser == null )
            if (true) {
                xmlParser = new XmlParser();
                xmlParser.setValidating(isValidatingParser);
            }

            // Check if definition set already exist.
            if (xmlDefinitions == null) {
                xmlDefinitions = new XmlDefinitionsSet();
            }

            xmlParser.parse(input, xmlDefinitions);
        }
    } catch (SAXException ex) {
        if (log.isDebugEnabled()) {
            log.debug("Error while parsing file '" + filename + "'.");
            ex.printStackTrace();
        }

        throw new DefinitionsFactoryException("Error while parsing file '" + filename + "'. " + ex.getMessage(),
                ex);
    } catch (IOException ex) {
        /*throw new DefinitionsFactoryException*/
        if (log.isDebugEnabled()) {
            log.debug("IO Error while parsing file '" + filename + "'. " + ex.getMessage(), ex);
        }
    }

    return xmlDefinitions;
}

From source file:org.vulpe.commons.xml.XMLReader.java

public List<XMLAttribute> reader(final String xml) {
    final List<XMLAttribute> attributeList = new ArrayList<XMLAttribute>();
    if (StringUtils.isNotEmpty(xml)) {
        try {//from w w  w  . j av  a2 s. com
            final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            final DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
            final ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("utf-8"));
            final Document document = docBuilder.parse(bais);
            final Node entity = document.getChildNodes().item(0);
            final NodeList atributos = entity.getChildNodes();
            for (int i = 0; i < atributos.getLength(); i++) {
                final String attribute = atributos.item(i).getNodeName();
                if (!"#text".equals(attribute)) {
                    final String value = getChildTagValue((Element) entity, attribute);
                    attributeList.add(new XMLAttribute(attribute, value));
                }
            }
        } catch (SAXParseException err) {
            LOG.error("** Parsing error" + ", line " + err.getLineNumber() + ", uri " + err.getSystemId());
            LOG.error(" " + err.getMessage());
        } catch (SAXException e) {
            final Exception exception = e.getException();
            LOG.error(((exception == null) ? e.getMessage() : exception.getMessage()));
        } catch (Exception e) {
            LOG.error(e.getMessage());
        }
    }
    return attributeList;
}

From source file:org.wso2.carbon.dataservices.core.XSLTTransformer.java

public XSLTTransformer(String xsltPath)
        throws TransformerConfigurationException, DataServiceFault, IOException {
    this.xsltPath = xsltPath;
    TransformerFactory tFactory = TransformerFactory.newInstance();
    try {/*ww  w  .  j  av  a2  s.  c  o  m*/
        getSecuredDocumentBuilder(false).parse(DBUtils.getInputStreamFromPath(this.getXsltPath()));
    } catch (SAXException e) {
        throw new DataServiceFault(e, "Error in parsing XSLT file " + xsltPath
                + " Possible XML External entity attack, Error - " + e.getMessage());
    } catch (ParserConfigurationException e) {
        throw new DataServiceFault(e, "Error initializing secure document builder, Error - " + e.getMessage());
    }
    this.transformer = tFactory
            .newTransformer(new StreamSource(DBUtils.getInputStreamFromPath(this.getXsltPath())));
    this.xmlInputFactory = DBUtils.getXMLInputFactory();
}

From source file:org.wso2.carbon.identity.entitlement.EntitlementUtil.java

/**
 * Validates the given policy XML files against the standard XACML policies.
 *
 * @param policy Policy to validate//www . ja v a  2 s . c  om
 * @return return false, If validation failed or XML parsing failed or any IOException occurs
 */
public static boolean validatePolicy(PolicyDTO policy) {
    try {

        if (!"true".equalsIgnoreCase((String) EntitlementServiceComponent.getEntitlementConfig()
                .getEngineProperties().get(EntitlementExtensionBuilder.PDP_SCHEMA_VALIDATION))) {
            return true;
        }

        // there may be cases where you only updated the policy meta data in PolicyDTO not the
        // actual XACML policy String
        if (policy.getPolicy() == null || policy.getPolicy().trim().length() < 1) {
            return true;
        }

        //get policy version
        String policyXMLNS = getPolicyVersion(policy.getPolicy());

        Map<String, Schema> schemaMap = EntitlementServiceComponent.getEntitlementConfig().getPolicySchemaMap();
        //load correct schema by version
        Schema schema = schemaMap.get(policyXMLNS);

        if (schema != null) {
            //build XML document
            DocumentBuilder documentBuilder = getSecuredDocumentBuilder(false);
            InputStream stream = new ByteArrayInputStream(policy.getPolicy().getBytes());
            Document doc = documentBuilder.parse(stream);
            //Do the DOM validation
            DOMSource domSource = new DOMSource(doc);
            DOMResult domResult = new DOMResult();
            Validator validator = schema.newValidator();
            validator.validate(domSource, domResult);
            if (log.isDebugEnabled()) {
                log.debug("XACML Policy validation succeeded with the Schema");
            }
            return true;
        } else {
            log.error("Invalid Namespace in policy");
        }
    } catch (SAXException e) {
        log.error("XACML policy is not valid according to the schema :" + e.getMessage());
    } catch (IOException e) {
        //ignore
    } catch (ParserConfigurationException e) {
        //ignore
    }
    return false;
}

From source file:org.wso2.carbon.repository.core.config.RepositoryConfigurationProcessor.java

/**
 * Read XML configuration from the passed InputStream, or from the classpath.
 *
 * @param in              an InputStream containing XML data, or null.
 * @param repositoryContext the RegistryContext to populate
 *
 * @throws RepositoryException if there's a problem
 *///from  w  w w  . j a  v  a  2  s.c  o m
public static void populateRepositoryConfig(InputStream in, RepositoryContext repositoryContext,
        RepositoryService registryService) throws RepositoryException {

    try {
        InputStream replacedStream = CarbonUtils.replaceSystemVariablesInXml(in);
        DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder();

        Document document = documentBuilder.parse(replacedStream);
        Element documentElement = document.getDocumentElement();
        documentElement.normalize();

        NodeList rootLists = documentElement.getElementsByTagName("registryRoot");

        if (rootLists != null && rootLists.getLength() > 0) {
            Node node = rootLists.item(0);

            if (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
                String registryRoot = ((Element) node).getTextContent();

                if (registryRoot != null && !registryRoot.equals(RepositoryConstants.ROOT_PATH)) {
                    if (registryRoot.endsWith(RepositoryConstants.PATH_SEPARATOR)) {
                        registryRoot = registryRoot.substring(0, registryRoot.length() - 1);
                    } else if (!registryRoot.startsWith(RepositoryConstants.PATH_SEPARATOR)) {
                        registryRoot = RepositoryConstants.ROOT_PATH + registryRoot;
                    }
                } else {
                    registryRoot = null;
                }

                repositoryContext.setRegistryRoot(registryRoot);
            }
        }

        NodeList readOnlyElements = documentElement.getElementsByTagName("readOnly");

        if (readOnlyElements != null && readOnlyElements.getLength() > 0) {
            Node node = readOnlyElements.item(0);

            if (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
                String isReadOnly = ((Element) node).getTextContent();
                repositoryContext.setReadOnly(CarbonUtils.isReadOnlyNode() || "true".equals(isReadOnly));
            }
        }

        NodeList enableCacheElements = documentElement.getElementsByTagName("enableCache");

        if (enableCacheElements != null && enableCacheElements.getLength() > 0) {
            Node node = enableCacheElements.item(0);

            if (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
                String enableCacheElement = ((Element) node).getTextContent();
                repositoryContext.setCacheEnabled("true".equals(enableCacheElement));
            }
        }

        SecretResolver secretResolver = SecretResolverFactory.create(documentElement, false);

        NodeList dbConfigElements = documentElement.getElementsByTagName("dbConfig");

        for (int index = 0; index < dbConfigElements.getLength(); index++) {
            Node dbConfig = dbConfigElements.item(index);
            DataBaseConfiguration dataBaseConfiguration = new DataBaseConfiguration();

            dataBaseConfiguration.setPasswordManager(secretResolver);

            if (dbConfig != null && dbConfig.getNodeType() == Node.ELEMENT_NODE) {
                Element dbConfigElement = (Element) dbConfig;
                String dbName = dbConfigElement.getAttribute("name");

                if (dbName == null) {
                    throw new RepositoryConfigurationException(
                            "The database configuration name cannot be null.");
                }

                dataBaseConfiguration.setConfigName(dbName);

                NodeList dbConfigDataSources = dbConfigElement.getChildNodes();

                for (int content = 0; content < dbConfigDataSources.getLength(); content++) {
                    Node dbConfigNode = dbConfigDataSources.item(content);

                    if (dbConfigNode != null && dbConfigNode.getNodeType() == Node.ELEMENT_NODE) {
                        if (dbConfigNode.getNodeName() == "dataSource") {
                            String dataSourceName = dbConfigNode.getTextContent();
                            dataBaseConfiguration.setDataSourceName(dataSourceName);
                            try {
                                Context context = new InitialContext();
                                Connection connection = null;

                                try {
                                    connection = ((DataSource) context.lookup(dataSourceName)).getConnection();
                                    DatabaseMetaData metaData = connection.getMetaData();

                                    dataBaseConfiguration.setDbUrl(metaData.getURL());
                                    dataBaseConfiguration.setUserName(metaData.getUserName());
                                } finally {
                                    if (connection != null) {
                                        connection.close();
                                    }
                                }
                            } catch (NamingException ignored) {
                                log.warn("Unable to look-up JNDI name " + dataSourceName);
                            } catch (SQLException e) {
                                e.printStackTrace();
                                throw new RepositoryDBException("Unable to connect to Data Source", e);
                            }
                        } else {
                            if (dbConfigNode.getNodeName() == "userName") {
                                dataBaseConfiguration.setUserName(dbConfigNode.getTextContent());
                            } else if (dbConfigNode.getNodeName() == "password") {
                                dataBaseConfiguration.setPassWord(dbConfigNode.getTextContent());
                            } else if (dbConfigNode.getNodeName() == "url") {
                                String dbUrl = dbConfigNode.getTextContent();

                                if (dbUrl != null) {
                                    if (dbUrl.contains(CarbonConstants.CARBON_HOME_PARAMETER)) {
                                        File carbonHomeDir;
                                        carbonHomeDir = new File(CarbonUtils.getCarbonHome());
                                        String path = carbonHomeDir.getPath();
                                        path = path.replaceAll(Pattern.quote("\\"), "/");

                                        if (carbonHomeDir.exists() && carbonHomeDir.isDirectory()) {
                                            dbUrl = dbUrl.replaceAll(
                                                    Pattern.quote(CarbonConstants.CARBON_HOME_PARAMETER), path);
                                        } else {
                                            log.warn("carbon home invalid");

                                            String[] tempStrings1 = dbUrl.split(
                                                    Pattern.quote(CarbonConstants.CARBON_HOME_PARAMETER));
                                            String tempUrl = tempStrings1[1];
                                            String[] tempStrings2 = tempUrl.split("/");

                                            for (int i = 0; i < tempStrings2.length - 1; i++) {
                                                dbUrl = tempStrings1[0] + tempStrings2[i] + "/";
                                            }

                                            dbUrl = dbUrl + tempStrings2[tempStrings2.length - 1];
                                        }
                                    }
                                }

                                dataBaseConfiguration.setDbUrl(dbUrl);
                            } else if (dbConfigNode.getNodeName() == "maxWait") {
                                dataBaseConfiguration.setMaxWait(dbConfigNode.getTextContent());
                            } else if (dbConfigNode.getNodeName() == "maxActive") {
                                dataBaseConfiguration.setMaxActive(dbConfigNode.getTextContent());
                            } else if (dbConfigNode.getNodeName() == "minIdle") {
                                dataBaseConfiguration.setMinIdle(dbConfigNode.getTextContent());
                            } else if (dbConfigNode.getNodeName() == "driverName") {
                                dataBaseConfiguration.setDriverName(dbConfigNode.getTextContent());
                            }
                        }
                    }
                }

                repositoryContext.addDBConfig(dbName, dataBaseConfiguration);
            }
        }

        NodeList staticConfigNodes = documentElement.getElementsByTagName("staticConfiguration");

        if (staticConfigNodes != null && staticConfigNodes.getLength() > 0) {
            Node staticConfigNode = staticConfigNodes.item(0);
            NodeList staticConfigItems = staticConfigNode.getChildNodes();

            for (int index = 0; index < staticConfigItems.getLength(); index++) {
                Node staticConfig = staticConfigItems.item(index);

                if (staticConfig != null && staticConfig.getNodeType() == Node.ELEMENT_NODE) {
                    if (staticConfig.getNodeName().equals("versioningProperties")) {
                        String versioningProperties = staticConfig.getTextContent();
                        StaticConfiguration.setVersioningProperties(versioningProperties.equals("true"));
                    } else if (staticConfig.getNodeName().equals("profilesPath")) {
                        String profilesPath = staticConfig.getTextContent();

                        if (!profilesPath.startsWith(RepositoryConstants.PATH_SEPARATOR)) {
                            profilesPath = RepositoryConstants.PATH_SEPARATOR + profilesPath;
                        }

                        if (profilesPath.endsWith(RepositoryConstants.PATH_SEPARATOR)) {
                            profilesPath = profilesPath.substring(0, (profilesPath.length() - 1));
                        }

                        if (profilesPath != null) {
                            if (profilesPath.startsWith(RepositoryConstants.CONFIG_REGISTRY_BASE_PATH)) {
                                repositoryContext.setProfilesPath(profilesPath);
                            } else {
                                repositoryContext.setProfilesPath(
                                        RepositoryConstants.CONFIG_REGISTRY_BASE_PATH + profilesPath);
                            }
                        }
                    } else if (staticConfig.getNodeName().equals("servicePath")) {
                        String servicePath = staticConfig.getTextContent();

                        if (!servicePath.startsWith(RepositoryConstants.PATH_SEPARATOR)) {
                            servicePath = RepositoryConstants.PATH_SEPARATOR + servicePath;
                        }

                        if (servicePath.endsWith(RepositoryConstants.PATH_SEPARATOR)) {
                            servicePath = servicePath.substring(0, (servicePath.length() - 1));
                        }

                        if (servicePath != null) {
                            if (servicePath.startsWith(RepositoryConstants.GOVERNANCE_REGISTRY_BASE_PATH)) {
                                repositoryContext.setServicePath(servicePath);
                            } else {
                                repositoryContext.setServicePath(
                                        RepositoryConstants.GOVERNANCE_REGISTRY_BASE_PATH + servicePath);
                            }
                        }
                    }
                }
            }
        }

        NodeList currentDBConfigs = documentElement.getElementsByTagName("currentDBConfig");

        if (currentDBConfigs == null) {
            throw new RepositoryConfigurationException("The current database configuration is not defined.");
        }

        String currentConfigName = currentDBConfigs.item(0).getTextContent();

        readRemoteInstances(documentElement, repositoryContext, secretResolver);

        readMounts(documentElement, repositoryContext);

        DataBaseConfiguration dbConfiguration = repositoryContext.selectDBConfig(currentConfigName);
        repositoryContext.setDefaultDataBaseConfiguration(dbConfiguration);

        NodeList versionConfigList = documentElement.getElementsByTagName("versionResourcesOnChange");

        if (versionConfigList != null && versionConfigList.getLength() > 0) {
            Node versionConfig = versionConfigList.item(0);
            if (versionConfig != null && "true".equals(versionConfig.getTextContent())) {
                repositoryContext.setVersionOnChange(true);
            } else {
                repositoryContext.setVersionOnChange(false);
            }
        }

        initializeHandlers(documentElement, repositoryContext);

        // process query processor configuration
        NodeList queryProcessors = documentElement.getElementsByTagName("queryProcessor");

        for (int index = 0; index < queryProcessors.getLength(); index++) {
            QueryProcessorConfiguration queryProcessorConfiguration = new QueryProcessorConfiguration();

            Node queryProcessorNode = queryProcessors.item(index);
            NodeList queryProcessorChildren = queryProcessorNode.getChildNodes();

            for (int childIndex = 0; childIndex < queryProcessorChildren.getLength(); childIndex++) {
                Node queryProcessorChild = queryProcessorChildren.item(childIndex);

                if (queryProcessorChild != null && queryProcessorChild.getNodeType() == Node.ELEMENT_NODE) {
                    if (queryProcessorChild.getNodeName() == "queryType") {
                        queryProcessorConfiguration.setQueryType(queryProcessorChild.getTextContent());
                    } else if (queryProcessorChild.getNodeName() == "processor") {
                        queryProcessorConfiguration.setProcessorClassName(queryProcessorChild.getTextContent());
                    }
                }
            }

            repositoryContext.addQueryProcessor(queryProcessorConfiguration);
        }
    } catch (SAXException e1) {
        throw new RepositoryInitException(e1.getMessage());
    } catch (IOException e1) {
        throw new RepositoryInitException(e1.getMessage());
    } catch (ParserConfigurationException e1) {
        throw new RepositoryInitException(e1.getMessage());
    } catch (CarbonException e) {
        log.error("An error occurred during system variable replacement", e);
    }
}