You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Ron Grabowski (JIRA)" <ib...@incubator.apache.org> on 2005/05/25 00:24:51 UTC

[jira] Commented: (IBATISNET-71) Resources.GetFileInfo(string) may return incorrect value if access to external location is denied

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

The fix in SVN throws an ArgumentException when passing in the default filename "sqlMap.config" becuase the file name is not absolute. From the documentation for FileIOPermission:

"
FileIOPermission ( System.Security.Permissions.FileIOPermissionAccess access , System.String path )

Parameters:
access: A bitwise combination of the System.Security.Permissions.FileIOPermissionAccess values.
path: The absolute path of the file or directory.

Exceptions:
System.ArgumentException: The access parameter is not a valid value of System.Security.Permissions.FileIOPermissionAccess.  -or- The path parameter is not a valid string.  -or- The path parameter did not specify the absolute path to the file or directory.  
"

[ConfigurationException: iBATIS doesn't have the right to read the config file "sqlmap.config". Cause : Absolute path information is required.]

I tried putting all of FileIOPermission into the try block but the argument exception was still passed up (expected behaviour):

try
{
 FileIOPermission filePermission = new FileIOPermission(FileIOPermissionAccess.Read, filePath);	
 filePermission.Demand();
}

Previous to this revision everything was working fine.

> 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