[ 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to