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/16 07:41:29 UTC

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

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
    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


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

Posted by "Gabriele Garuglieri (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=comments#action_12429724 ] 
            
Gabriele Garuglieri commented on CONFIGURATION-216:
---------------------------------------------------

Hi Oliver,
i've found a condition in which the fix won't work.
Given this snippet of code:
DefaultConfigurationBuilder cf =  new DefaultConfigurationBuilder("conf/config/deep/testFileFromClasspath.xml");
 CombinedConfiguration config = cf.getConfiguration(true);
 assertNotNull(config.getConfiguration("propConf"));

that loads this configuration file:
<configuration>
  <properties config-name="propConf" fileName="testEqual.properties"/>
</configuration>

with "testEqual.properties" located into "/conf" that is in classpath

will end up trying to load "conf/config/deep/testEqual.properties" which is not found.

I've reworked a bit the code and produced a patch that should correct the problem.
You migth not agree on the code but at least it should give you the idea of the flaw in the previous implementation.

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: 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


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

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=comments#action_12430092 ] 
            
Oliver Heger commented on CONFIGURATION-216:
--------------------------------------------

Patch applied. Many thanks!

I made the following minor changes:
- Changed the visibility of ConfigurationUtils.locateFromClasspath() to package scope; there is no need to make this method part of the public API.
- Excluded the tests that try to access the jar file. We had some trouble with this jar (see ticket CONFIGURATION-71), which I don't want to have again.

Regarding JMXConfiguration: That would be really cool. JMX is on our roadmap for future releases.

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216-1.patch, resources.jar
>
>
> 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


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

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=all ]

Oliver Heger updated CONFIGURATION-216:
---------------------------------------

    Attachment:     (was: 216.patch)

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216-1.patch, resources.jar
>
>
> 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


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

Posted by "Gabriele Garuglieri (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=all ]

Gabriele Garuglieri updated CONFIGURATION-216:
----------------------------------------------

    Attachment: 216.patch

Testcase for the error condition and corrective patch

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216.patch
>
>
> 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


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

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=all ]
     
Oliver Heger resolved CONFIGURATION-216:
----------------------------------------

    Resolution: Fixed

Should be fixed now in subversion, revision 416102. Please double check.

> 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


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

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=comments#action_12417354 ] 

Oliver Heger commented on CONFIGURATION-216:
--------------------------------------------

You are right! The problem did not occur to me because I use the maven build. And after a maven build ran successfully the ant build is successful, too, because maven copies the files to the right location.

Well, I changed the copying stuff in build.xml, and now both builds should work. Sorry!

> 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


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

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CONFIGURATION-216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger updated CONFIGURATION-216:
---------------------------------------

    Fix Version/s:     (was: Nightly Builds)
                   1.3

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>             Fix For: 1.3
>
>         Attachments: 216-1.patch, resources.jar
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


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


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

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=all ]

Oliver Heger resolved CONFIGURATION-216.
----------------------------------------

    Fix Version/s: Nightly Builds
       Resolution: Fixed

Marking this issue as resolved. Please double check and reopen if you still encounter problems.

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>             Fix For: Nightly Builds
>
>         Attachments: 216-1.patch, resources.jar
>
>
> 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


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

Posted by "Oliver Heger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=comments#action_12429798 ] 
            
Oliver Heger commented on CONFIGURATION-216:
--------------------------------------------

I had a look at your patch. Looks good, and all unit tests are running.

One change is problematic however: You removed the methods get/setPath() from AbstractFileConfiguration. This is a binary incompatible change, i.e. it would break existing code. So we can't do this. Is there a special reason why you deleted these methods?

I am also a bit concerned regarding semantic compatibility. You had to change the testLocations() test case, which means that the behavior of some of the methods has changed. This could also have an impact on existing code. Wouldn't it be possible to keep the behavior of these methods and only do some additional checks in ConfigurationUtils.locate() ?

In any case: Many thanks for your effort!

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216.patch
>
>
> 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


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

Posted by "Gabriele Garuglieri (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=comments#action_12429954 ] 
            
Gabriele Garuglieri commented on CONFIGURATION-216:
---------------------------------------------------

Hi Oliver,
you are rigth, removing that methods was an overkill.
There are simply too many way to set the same things in sligtly different manner and i was confused.

I restored all the previous semantic with a difference that should not impact existing code other than avoiding an NPE in a particular case.
The getPath() method now check if getFile() returns null, which may be the case when the config was loaded from a jar in classpath, then, if the config was loaded from a jar in classpath it returns instead the String form of the URL from which it was loaded.
In this way you are always able to know the config location.

I added indication in javadoc that if you are referencing files from classpath with relative paths only setFilename() must be used because setPath() tries to expand to an absolute path which may give invalid references for files in classpath.

I also added some more testcases to check classpath references behaviour.
I left some logging into the added testcases to show you the new behaviour of getPath(), you can safely remove it if you want.

Regards,  Gabriele

PS. I'm developing a JMXConfiguration, based on 1.3, for my own usage in our applications. I've a working  prototype that allows to get/set and persist properties. If you are interested i can share the code once i've got something stable.


> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216.patch
>
>
> 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


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

Posted by "Gabriele Garuglieri (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=all ]

Gabriele Garuglieri updated CONFIGURATION-216:
----------------------------------------------

    Attachment: 216-1.patch
                resources.jar

New version of the patch and expanded resources.jar needed for sone new testcases.

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216-1.patch, 216.patch, resources.jar
>
>
> 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


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

Posted by "Gabriele Garuglieri (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=comments#action_12429958 ] 
            
Gabriele Garuglieri commented on CONFIGURATION-216:
---------------------------------------------------

Perhaps Jira hates me? :(
How can i obsolete an attachment like with bugzilla?

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216-1.patch, 216.patch, resources.jar
>
>
> 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


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

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=all ]

Joerg Schaible reopened CONFIGURATION-216:
------------------------------------------

             
Reopened by request. Since the bug is "only" resolved, you should have been able to do so yourself. But maybe there's a flaw in the JIRA workflow configuration ...

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216.patch
>
>
> 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


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

Posted by "Gabriele Garuglieri (JIRA)" <ji...@apache.org>.
    [ 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


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

Posted by "Gabriele Garuglieri (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CONFIGURATION-216?page=comments#action_12429730 ] 
            
Gabriele Garuglieri commented on CONFIGURATION-216:
---------------------------------------------------

After fiddling for a while with this bug it looks that, even if i'm the reporter, i miss the authority to reopen it, or simply i could'nt manage to understand how to do it :)

> Inconsistent way to locate filename when creating configuration
> ---------------------------------------------------------------
>
>                 Key: CONFIGURATION-216
>                 URL: http://issues.apache.org/jira/browse/CONFIGURATION-216
>             Project: Commons Configuration
>          Issue Type: Bug
>         Environment: commons-configuration-1.3-dev
>            Reporter: Gabriele Garuglieri
>         Assigned To: Oliver Heger
>            Priority: Minor
>         Attachments: 216.patch
>
>
> 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