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/04/13 17:56:16 UTC
[jira] Created: (IBATISNET-37) An exception is thrown when a file watch is applied to an embedded resource
An exception is thrown when a file watch is applied to an embedded resource
---------------------------------------------------------------------------
Key: IBATISNET-37
URL: http://issues.apache.org/jira/browse/IBATISNET-37
Project: iBatis for .NET
Type: Bug
Versions: DataMapper 1.1
Environment: [assembly: AssemblyVersion("1.5.458")]
Reporter: Ron Grabowski
As of 4/13/2005, the version of IBatisNet in SVN contains the following code on line 505 of DomSqlMapBuilder.cs:
private void ConfigureSqlMap( )
{
XmlSerializer serializer = null;
XmlNode sqlMapNode = _configScope.NodeContext;
_configScope.ErrorContext.Activity = "loading SqlMap ";
_configScope.ErrorContext.Resource = sqlMapNode.OuterXml.ToString();
if (_configScope.UseConfigFileWatcher == true)
{
ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( Resources.GetValueOfNodeResourceUrl(sqlMapNode) ) );
}
Resources.GetValueOfNodeResourceUrl does not contain a case for "embedded" (this is correct becuase embedded files do not reside on the file system:
public static string GetValueOfNodeResourceUrl(XmlNode node)
{
string path = null;
if (node.Attributes["resource"] != null)
{
path = Path.Combine(_applicationBase, node.Attributes["resource"].Value);
}
else if (node.Attributes["url"] != null)
{
path = node.Attributes["url"].Value;
}
return path;
}
In the case of embedded resources, GetValueOfNodeResourceUrl returns null. The null value is then passed up to Resources.GetFileInfo which makes a call to Path.Combine. An exception is throw becuase Path.Combine cannot be sent a null value:
[ArgumentNullException: Value cannot be null.
Parameter name: path2]
System.IO.Path.Combine(String path1, String path2)
One solution would be to wrap the call to AddFileToWatch to make sure the sqlMap has a resource or a url attribute:
if (sqlMapNode.Attributes["resource"] != null || sqlMapNode.Attributes["url"] != null)
{
if (_configScope.UseConfigFileWatcher == true)
{
ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( Resources.GetValueOfNodeResourceUrl(sqlMapNode) ) );
}
}
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Closed: (IBATISNET-37) An exception is thrown when a file watch is applied to an embedded resource
Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/IBATISNET-37?page=history ]
Gilles Bayon closed IBATISNET-37:
---------------------------------
Resolution: Fixed
Fix Version: DataMapper 1.2
> An exception is thrown when a file watch is applied to an embedded resource
> ---------------------------------------------------------------------------
>
> Key: IBATISNET-37
> URL: http://issues.apache.org/jira/browse/IBATISNET-37
> Project: iBatis for .NET
> Type: Bug
> Versions: DataMapper 1.1
> Environment: [assembly: AssemblyVersion("1.5.458")]
> Reporter: Ron Grabowski
> Assignee: Gilles Bayon
> Fix For: DataMapper 1.2
>
> As of 4/13/2005, the version of IBatisNet in SVN contains the following code on line 505 of DomSqlMapBuilder.cs:
> private void ConfigureSqlMap( )
> {
> XmlSerializer serializer = null;
> XmlNode sqlMapNode = _configScope.NodeContext;
> _configScope.ErrorContext.Activity = "loading SqlMap ";
> _configScope.ErrorContext.Resource = sqlMapNode.OuterXml.ToString();
> if (_configScope.UseConfigFileWatcher == true)
> {
> ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( Resources.GetValueOfNodeResourceUrl(sqlMapNode) ) );
> }
> Resources.GetValueOfNodeResourceUrl does not contain a case for "embedded" (this is correct becuase embedded files do not reside on the file system:
> public static string GetValueOfNodeResourceUrl(XmlNode node)
> {
> string path = null;
> if (node.Attributes["resource"] != null)
> {
> path = Path.Combine(_applicationBase, node.Attributes["resource"].Value);
> }
> else if (node.Attributes["url"] != null)
> {
> path = node.Attributes["url"].Value;
> }
> return path;
> }
> In the case of embedded resources, GetValueOfNodeResourceUrl returns null. The null value is then passed up to Resources.GetFileInfo which makes a call to Path.Combine. An exception is throw becuase Path.Combine cannot be sent a null value:
> [ArgumentNullException: Value cannot be null.
> Parameter name: path2]
> System.IO.Path.Combine(String path1, String path2)
> One solution would be to wrap the call to AddFileToWatch to make sure the sqlMap has a resource or a url attribute:
> if (sqlMapNode.Attributes["resource"] != null || sqlMapNode.Attributes["url"] != null)
> {
> if (_configScope.UseConfigFileWatcher == true)
> {
> ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( Resources.GetValueOfNodeResourceUrl(sqlMapNode) ) );
> }
> }
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Assigned: (IBATISNET-37) An exception is thrown when a file watch is applied to an embedded resource
Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/IBATISNET-37?page=history ]
Gilles Bayon reassigned IBATISNET-37:
-------------------------------------
Assign To: Gilles Bayon
> An exception is thrown when a file watch is applied to an embedded resource
> ---------------------------------------------------------------------------
>
> Key: IBATISNET-37
> URL: http://issues.apache.org/jira/browse/IBATISNET-37
> Project: iBatis for .NET
> Type: Bug
> Versions: DataMapper 1.1
> Environment: [assembly: AssemblyVersion("1.5.458")]
> Reporter: Ron Grabowski
> Assignee: Gilles Bayon
> Fix For: DataMapper 1.2
>
> As of 4/13/2005, the version of IBatisNet in SVN contains the following code on line 505 of DomSqlMapBuilder.cs:
> private void ConfigureSqlMap( )
> {
> XmlSerializer serializer = null;
> XmlNode sqlMapNode = _configScope.NodeContext;
> _configScope.ErrorContext.Activity = "loading SqlMap ";
> _configScope.ErrorContext.Resource = sqlMapNode.OuterXml.ToString();
> if (_configScope.UseConfigFileWatcher == true)
> {
> ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( Resources.GetValueOfNodeResourceUrl(sqlMapNode) ) );
> }
> Resources.GetValueOfNodeResourceUrl does not contain a case for "embedded" (this is correct becuase embedded files do not reside on the file system:
> public static string GetValueOfNodeResourceUrl(XmlNode node)
> {
> string path = null;
> if (node.Attributes["resource"] != null)
> {
> path = Path.Combine(_applicationBase, node.Attributes["resource"].Value);
> }
> else if (node.Attributes["url"] != null)
> {
> path = node.Attributes["url"].Value;
> }
> return path;
> }
> In the case of embedded resources, GetValueOfNodeResourceUrl returns null. The null value is then passed up to Resources.GetFileInfo which makes a call to Path.Combine. An exception is throw becuase Path.Combine cannot be sent a null value:
> [ArgumentNullException: Value cannot be null.
> Parameter name: path2]
> System.IO.Path.Combine(String path1, String path2)
> One solution would be to wrap the call to AddFileToWatch to make sure the sqlMap has a resource or a url attribute:
> if (sqlMapNode.Attributes["resource"] != null || sqlMapNode.Attributes["url"] != null)
> {
> if (_configScope.UseConfigFileWatcher == true)
> {
> ConfigWatcherHandler.AddFileToWatch( Resources.GetFileInfo( Resources.GetValueOfNodeResourceUrl(sqlMapNode) ) );
> }
> }
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira