[ 
https://issues.apache.org/jira/browse/CONFIGURATION-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517915
 ] 

Thorbjørn Ravn Andersen commented on CONFIGURATION-285:
-------------------------------------------------------

I have now tried running this with the trunk code, and now an Internal Error is 
logged for every optional sub-configuration which is not present i.e.

689 [main] WARN org.apache.commons.configuration.DefaultConfigurationBuilder  - 
Internal error
org.apache.commons.configuration.ConfigurationException: Cannot locate 
configuration source 
application-ConfigurationLoader.main-configuration-defaults.xml

which corresponds to 

<configuration>
...
        <configuration 
fileName="4s-application-${application}-configuration-defaults.xml" 
config-optional="true" />
</configuration>

in the bootstrap configuration file.

This apparently is caused by the AbstractConfiguration.addErrorListener() call 
in the AbstractConfiguration constructor.

Generally a stacktrace in our log means big trouble, so this behaviour is 
actually worse than before.   Any suggestions?

> <configuration fileName="local-configuration.xml" config-optional="true" /> 
> does not report parsing errors in local-configuration.xml
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-285
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-285
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Thorbjørn Ravn Andersen
>            Assignee: Oliver Heger
>             Fix For: 1.5
>
>
> I'm trying to build a configuration system to be shared between our Java 
> applications.  I therefore want to have optional configurations included from 
> the main configuration file read by DefaultConfigurationBuilder
> <configuration fileName="local-configuration.xml" config-optional="true" />
> I have found that if the sub-configuration file is invalid the error is 
> silently ignored.  The same without config-options="true" results in a 
> ConfigurationException to be thrown (which wraps a 
> ConfigurationRuntimeException which wraps the ConfigurationException which 
> wraps the SAXException).
> I believe that the behaviour is incorrect.  The sub-configuration file should 
> be skipped if not found, but any errors found when parsing the existing file 
> should be logged.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to