You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Gabriele Garuglieri (JIRA)" <ji...@apache.org> on 2006/06/22 08:30:31 UTC

[jira] Commented: (CONFIGURATION-216) Inconsistent way to locate filename when creating configuration

    [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=comments#action_12417252 ] 

Gabriele Garuglieri commented on CONFIGURATION-216:
---------------------------------------------------

Hi Oliver,
taking it just out of the box results in:
    [junit] Testcase: testInitFromClassPath took 0 sec
    [junit] Caused an ERROR
    [junit] Cannot locate configuration source config/deep/deeptest.properties
    [junit] org.apache.commons.configuration.ConfigurationException: Cannot locate configuration source config/deep/deeptest.properties
    [junit] at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:208)
    [junit] at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:188)
    [junit] at org.apache.commons.configuration.TestFileConfiguration.testInitFromClassPath(TestFileConfiguration.java:489)
when running tests during build.

The problem is that in build.xml you copy "config/deep/deeptest.properties" into a further "config" nesting level so changing 
private static final String RESOURCE_NAME = "config/deep/deeptest.properties";
into
private static final String RESOURCE_NAME = "config/config/deep/deeptest.properties";
into TestFileConfiguration, makes everything working.

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>          Key: CONFIGURATION-216
>          URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>      Project: Commons Configuration
>         Type: Bug

>  Environment: commons-configuration-1.3-dev
>     Reporter: Gabriele Garuglieri
>     Assignee: Oliver Heger
>     Priority: Minor

>
> There is a different behaviour locating the configuration file in classpath depending on the way it is set in the configuration class.
> For example assuming "conf/conf1.properties" exists in classpath:
> PropertiesConfiguration pc = new PropertiesConfiguration("conf/conf1.properties");
> gives org.apache.commons.configuration.ConfigurationException: Cannot locate configuration source conf1.properties
> while
> PropertiesConfiguration pc = new PropertiesConfiguration();
> pc.setFileName("conf/conf1.properties");
> pc.load();
> properly locate file in classpath and loads it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org