You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Moran Ben-David <mo...@place-base.com> on 2005/08/31 19:41:58 UTC

[configuration] PropertiesConfiguration doesn't throw exception when path is a directory

Hi all,

I recently noticed that when I use a string which is a directory to create a
PropertiesConfiguration, no exception is thrown.  Is this by intention?

For example, I do

<code>
PropertiesConfiguration temp = 
	new PropertiesConfiguration("c:/baddirectory");
</code>

I get the expected

<code>
org.apache.commons.configuration.ConfigurationException: Cannot locate
configuration source baddirectory
</code>

However, when I do 

PropertiesConfiguration temp2 = new PropertiesConfiguration("c:/windows");

I don't get any exception.  Is this a desired behaviour?  The difference
between "baddirectory" and "windows" is that the former doesn't exist and
the latter does.

Thanks,
Moran


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


RE: [configuration] PropertiesConfiguration doesn't throw exception when path is a directory

Posted by Moran Ben-David <mo...@place-base.com>.
Done.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36488

Again... thanks for looking into my issue, Oliver.

Moran

> -----Original Message-----
> From: Oliver Heger [mailto:oliver.heger@t-online.de]
> Sent: Saturday, September 03, 2005 5:17 AM
> To: Jakarta Commons Users List
> Subject: Re: [configuration] PropertiesConfiguration doesn't throw
> exception when path is a directory
> 
> Moran Ben-David wrote:
> 
> >Hi all,
> >
> >I recently noticed that when I use a string which is a directory to
> create a
> >PropertiesConfiguration, no exception is thrown.  Is this by intention?
> >
> >For example, I do
> >
> ><code>
> >PropertiesConfiguration temp =
> >	new PropertiesConfiguration("c:/baddirectory");
> ></code>
> >
> >I get the expected
> >
> ><code>
> >org.apache.commons.configuration.ConfigurationException: Cannot locate
> >configuration source baddirectory
> ></code>
> >
> >However, when I do
> >
> >PropertiesConfiguration temp2 = new
> PropertiesConfiguration("c:/windows");
> >
> >I don't get any exception.  Is this a desired behaviour?  The difference
> >between "baddirectory" and "windows" is that the former doesn't exist and
> >the latter does.
> >
> >Thanks,
> >Moran
> >
> >
> >
> This is surely no intended behavior. I have not yet looked into this in
> detail, but I assume that the problem lies in the algorithm for locating
> configuration files: This algorithm - amongst other things - checks for
> the passed in name if it can be converted to a File object and this
> object's exists() method returns true. We will probably have to ensure
> that this handle does not point to a directory, too.
> 
> Thanks for spotting this. Would you please be so kind to open a Bugzilla
> ticket for this issue.
> 
> Thanks,
> Oliver
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


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


Re: [configuration] PropertiesConfiguration doesn't throw exception when path is a directory

Posted by Oliver Heger <ol...@t-online.de>.
Moran Ben-David wrote:

>Hi all,
>
>I recently noticed that when I use a string which is a directory to create a
>PropertiesConfiguration, no exception is thrown.  Is this by intention?
>
>For example, I do
>
><code>
>PropertiesConfiguration temp = 
>	new PropertiesConfiguration("c:/baddirectory");
></code>
>
>I get the expected
>
><code>
>org.apache.commons.configuration.ConfigurationException: Cannot locate
>configuration source baddirectory
></code>
>
>However, when I do 
>
>PropertiesConfiguration temp2 = new PropertiesConfiguration("c:/windows");
>
>I don't get any exception.  Is this a desired behaviour?  The difference
>between "baddirectory" and "windows" is that the former doesn't exist and
>the latter does.
>
>Thanks,
>Moran
>
>  
>
This is surely no intended behavior. I have not yet looked into this in 
detail, but I assume that the problem lies in the algorithm for locating 
configuration files: This algorithm - amongst other things - checks for 
the passed in name if it can be converted to a File object and this 
object's exists() method returns true. We will probably have to ensure 
that this handle does not point to a directory, too.

Thanks for spotting this. Would you please be so kind to open a Bugzilla 
ticket for this issue.

Thanks,
Oliver

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