You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2014/07/12 18:22:04 UTC
[jira] [Commented] (CONFIGURATION-585) Hardcoded Parameters
prevents correct initialisation of XML DocumentBuilder
[ https://issues.apache.org/jira/browse/CONFIGURATION-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14059837#comment-14059837 ]
Oliver Heger commented on CONFIGURATION-585:
--------------------------------------------
I am sorry, but I do not understand this ticket. What exactly do you mean by hard-coded parameters and what should be read from a pom or should be made available from a Maven plug-in?
When reading an XML configuration file you can of course set parameters like the validation mode on the {{XMLConfiguration}} instance. You can even set a custom {{DocumentBuilder}} object which is configured according to your needs.
> 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
> Labels: XMLConfiguration
> Fix For: 2.0
>
> Original Estimate: 96h
> Remaining Estimate: 96h
>
> 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)