[ 
http://issues.apache.org/jira/browse/IBATISNET-71?page=comments#action_66216 ]
     
Ron Grabowski commented on IBATISNET-71:
----------------------------------------

Another minor point, if the file exists and I have read access to the directory 
where the file is located but the file itself is marked as non-readable the 
following code will return true:

 if (File.Exists(filePath)

but if I try to open the file:

 StreamReader sr = new StreamReader(@"c:\normal_directory\sqlmap.config");

I get the following exception:

System.UnauthorizedAccessException: Access to the path 
"c:\normal_directory\sqlmap.config" is denied.

I tested this in Windows XP. I'm able to rename the sample sqlmap.config file 
but when I try and open it using notepad, Visual Studio, or use the DOS type 
command, I get an access denied message. I'm still able to see the file in the 
directory listing so I know the file exists...I just don't have read access to 
it.

I doubt this will ever happen in the real world...

> Resources.GetFileInfo(string) may return incorrect value if access to 
> external location is denied
> -------------------------------------------------------------------------------------------------
>
>          Key: IBATISNET-71
>          URL: http://issues.apache.org/jira/browse/IBATISNET-71
>      Project: iBatis for .NET
>         Type: Bug
>     Reporter: Ron Grabowski
>     Assignee: Gilles Bayon
>     Priority: Minor
>      Fix For: DataMapper 1.2

>
> http://www.mail-archive.com/ibatis-dev%40incubator.apache.org/msg01176.html
> If permission is denied to the remote location:
>  Resources.GetFileInfo("c:/does_not_have_permission/sqlMap.config")
> and there is a file called sqlMap.config in the base directory of my 
> application:
>  /sqlMap.config
> File.Exists will return false if permission to the path is denied (see 
> mail-archive.com post for more info):
>  if (!File.Exists(path)) 
>  {
>   file = Path.Combine(_applicationBase, path);
>  }
>  else
>  {
>   file = path;
>  }
> A FileInfo object for the local sqlMap.config will be returned.
> I haven't actually tested this.

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

Reply via email to