You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Thomas Wabner (JIRA)" <ji...@apache.org> on 2007/02/15 10:25:05 UTC

[jira] Created: (IO-114) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
-----------------------------------------------------------------------------------

                 Key: IO-114
                 URL: https://issues.apache.org/jira/browse/IO-114
             Project: Commons IO
          Issue Type: Bug
            Reporter: Thomas Wabner


Taken from the maillinglist:

> I have a properties configuration which is loaded without a problem.
> Later in my application I will access the file which is aligned to 
> this configuration.
> 
>  
> 
> final IFileConfiguration _productConf = 
> _conf.getProductConfigurations().get(_productId);
> 
> log.debug("product conf file " + _productConf.getFile());
> 
> log.debug("product conf filename " + _productConf.getFileName());
> 
> log.debug("product conf base path " + _productConf.getBasePath());
> 
>  
> 
> The methods _productConf.getFile() and _productConf.getFileName() 
> returning null but the getBasePath() returns a path which is correct 
> (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> for me like a bug because the PropertiesConfiguration is loaded 
> correct and works.
> 
>  
> 
> By side: I have also set a file reloading strategy for this 
> configuration.
> 
>  
> 
> Any ideas what's happen in this case or where I can find the problem? 
> It would be nicer to get the File() instead the BasePath which has to 
> be converted into a URL before I can access the whole properties file.
> 
>  
> 
> Thanks in advance,
> 
>  
> 
> - Thomas Wabner
> 
> 
Thomas,

you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?

I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.

If you like, you can open a Jira ticket for this problem.

Thanks.
Oliver

The file is loaded in this way:

_productConf = new ProductConfiguration();
_productConf.load(FileTools.getPathForList(_propductPathList).getPath());

means the load method gets an String and not an File.



-- 
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] Commented: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

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

Oliver Heger commented on CONFIGURATION-253:
--------------------------------------------

The behavior since (I think) the 1.2 release is that a load() call sets the sourceURL if none has been set so far. This is required for supporting features like auto save and reloading strategies for configurations created this way (there is no hint in the docs that a source must be set explicitly for using these features, so I assume this is alright). What my fix does is to always keep the getFile() method in sync with the sourceURL; so if a sourceURL exists, getFile() will now return a corresponding File object.

Note that the URL is only modified on an initial load() call, i.e. if already a source was set, it won't be changed by a following load() call. This is intended. It allows for instance the easy creation of combined configurations: you can call load() as often as you like on a file-based configuration; the properties of the single sources will be accumulated. Then you can save the accumulated properties to the original source.

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Thomas Wabner
>             Fix For: 1.5
>
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Updated: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

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

Emmanuel Bourg updated CONFIGURATION-253:
-----------------------------------------

        Fix Version/s: 1.5
    Affects Version/s:     (was: 1.5)
                       1.3

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Thomas Wabner
>             Fix For: 1.5
>
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Commented: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

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

Oliver Heger commented on CONFIGURATION-253:
--------------------------------------------

I applied the fix as described in my last comment. Thomas, can you please check if this works for you?
Thanks.

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Thomas Wabner
>         Assigned To: Oliver Heger
>             Fix For: 1.5
>
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Updated: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

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

Oliver Heger updated CONFIGURATION-253:
---------------------------------------

    Affects Version/s: 1.5

We are just in the process of getting out the 1.4 release. I am reluctant to change the behavior of the getFile() and getFileName() methods now because this may cause a surprise for existing code. So this issue will be addressed in the following release.

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.5
>            Reporter: Thomas Wabner
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Commented: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

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

Oliver Heger commented on CONFIGURATION-253:
--------------------------------------------

After having a deeper look into this issue I am no longer sure that this is a bug. You loaded the configuration with the load(String) method, and the Javadocs for this method state

"This does not change the source of the configuration (i.e. the internally maintained file name). Use one of the setter methods for this purpose."

However I tend to agree that the current behavior is confusing. Why can you obtain a URL and a path name from a configuration loaded this way, but no File?

I have written a test case and implemented a (simple) fix, which would cause getFile() to return a valid file name in this case. What do others think? Should we change the current behavior?

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Thomas Wabner
>             Fix For: 1.5
>
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Moved: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

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

Niall Pemberton moved IO-114 to CONFIGURATION-253:
--------------------------------------------------

        Key: CONFIGURATION-253  (was: IO-114)
    Project: Commons Configuration  (was: Commons IO)

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>            Reporter: Thomas Wabner
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Commented: (IO-114) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473327 ] 

Henri Yandell commented on IO-114:
----------------------------------

Is this really an IO issue, or is it Configuration?

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: IO-114
>                 URL: https://issues.apache.org/jira/browse/IO-114
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Thomas Wabner
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Commented: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491581 ] 

Emmanuel Bourg commented on CONFIGURATION-253:
----------------------------------------------

If the URL and the basepath are set on calling load(), then this is a bug since the source should not change.

If we have to change the current behavior, I prefer that load() changes the source only if no source is already set.

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Thomas Wabner
>             Fix For: 1.5
>
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Commented: (IO-114) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

Posted by "Thomas Wabner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473328 ] 

Thomas Wabner commented on IO-114:
----------------------------------

upps, sorry. It is of corse commons-configuration related. Sorry for that mistake. Is there is a way to move this bug or should I close and create it again in the right product?

- Thomas Wabner

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: IO-114
>                 URL: https://issues.apache.org/jira/browse/IO-114
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Thomas Wabner
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Commented: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491778 ] 

Emmanuel Bourg commented on CONFIGURATION-253:
----------------------------------------------

That looks good, the structure of the chained else/if could even be simplified.

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Thomas Wabner
>         Assigned To: Oliver Heger
>             Fix For: 1.5
>
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

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

Oliver Heger resolved CONFIGURATION-253.
----------------------------------------

    Resolution: Fixed

I think this issue can now be marked as fixed.

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Thomas Wabner
>         Assigned To: Oliver Heger
>             Fix For: 1.5
>
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

-- 
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] Commented: (CONFIGURATION-253) FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent

Posted by "Thomas Wabner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CONFIGURATION-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491569 ] 

Thomas Wabner commented on CONFIGURATION-253:
---------------------------------------------

I think that for my case the javadoc is not very helpful. If I create a new Configuration, there cannot be a "source" - or in this case the source is null. 

If a load method doesn't change the source, what means in this case "load"?

If I load any data into a configuration, I change the source of the configuration. The source in the configuration object should always point to the latest source object from outside.

I think we have to clearify what we mean with "load".

Olivers quick fix means that the load method works as I aspected -> it changes the source in the configuration to the last source for the configuration.

This should always only available for a file based configuration. In the case of the database configuration the bahavior should be differnet
(I don't have yet take a look into the database stuff).

So I vote to change the current behavior.

> FileConfiguration getFile(), getFileName(), getBasePath() are not always consistent
> -----------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-253
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-253
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Thomas Wabner
>             Fix For: 1.5
>
>
> Taken from the maillinglist:
> > I have a properties configuration which is loaded without a problem.
> > Later in my application I will access the file which is aligned to 
> > this configuration.
> > 
> >  
> > 
> > final IFileConfiguration _productConf = 
> > _conf.getProductConfigurations().get(_productId);
> > 
> > log.debug("product conf file " + _productConf.getFile());
> > 
> > log.debug("product conf filename " + _productConf.getFileName());
> > 
> > log.debug("product conf base path " + _productConf.getBasePath());
> > 
> >  
> > 
> > The methods _productConf.getFile() and _productConf.getFileName() 
> > returning null but the getBasePath() returns a path which is correct 
> > (like file:/C:/Projects/workspace/myProject/project.properties). Seems 
> > for me like a bug because the PropertiesConfiguration is loaded 
> > correct and works.
> > 
> >  
> > 
> > By side: I have also set a file reloading strategy for this 
> > configuration.
> > 
> >  
> > 
> > Any ideas what's happen in this case or where I can find the problem? 
> > It would be nicer to get the File() instead the BasePath which has to 
> > be converted into a URL before I can access the whole properties file.
> > 
> >  
> > 
> > Thanks in advance,
> > 
> >  
> > 
> > - Thomas Wabner
> > 
> > 
> Thomas,
> you are right, the conversions between a base path, a file name, and a File are not always consistent. How did you load the configuration (this determines, which internal fields are set)?
> I would recommend to work with URLs, i.e. the method getURL(). A file-based configuration's URL is always defined.
> If you like, you can open a Jira ticket for this problem.
> Thanks.
> Oliver
> The file is loaded in this way:
> _productConf = new ProductConfiguration();
> _productConf.load(FileTools.getPathForList(_propductPathList).getPath());
> means the load method gets an String and not an File.

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