You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Martin Gainty (JIRA)" <ji...@apache.org> on 2014/07/12 03:34:06 UTC

[jira] [Created] (CONFIGURATION-585) Hardcoded Parameters prevents correct initialisation of XML DocumentBuilder

Martin Gainty created CONFIGURATION-585:
-------------------------------------------

             Summary: Hardcoded Parameters prevents correct initialisation of XML DocumentBuilder
                 Key: CONFIGURATION-585
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-585
             Project: Commons Configuration
          Issue Type: Bug
          Components: File reloading
    Affects Versions: 1.8
         Environment: JDK 1.7.0.45
MvN 3.0.5
            Reporter: Martin Gainty
            Priority: Blocker
             Fix For: 2.0


XMLConfiguration:
 protected DocumentBuilder createDocumentBuilder()
            throws ParserConfigurationException
    {
        if (getDocumentBuilder() != null)
        {
            return getDocumentBuilder();
        }
        else
        {
            DocumentBuilderFactory factory = DocumentBuilderFactory
                    .newInstance();
            if (isValidating())
            {
                factory.setValidating(true);
                if (isSchemaValidation())
                {
                    factory.setNamespaceAware(true);
                    factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                }
            }

            DocumentBuilder result = factory.newDocumentBuilder();
            result.setEntityResolver(this.entityResolver);

            if (isValidating())
            {
                // register an error handler which detects validation errors
                result.setErrorHandler(new DefaultHandler()
                {
                    @Override
                    public void error(SAXParseException ex) throws SAXException
                    {
                        throw ex;
                    }
                });
            }
            return result;
        }
    }
There is no way to externally set any of these parameters
I propose 2 changes
1)read properties from pom.xml
2)morph this into a XMLConfigurationPlugin which will run goal to set the params from configuration for new commons-configuration-plugin
(Bug originally reported by Ron DiFrango from CapitalOne)
Martin Gainty
11 July 2014



--
This message was sent by Atlassian JIRA
(v6.2#6252)