You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by rg...@apache.org on 2006/01/11 04:14:50 UTC
svn commit: r367891 -
/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
Author: rgrabowski
Date: Tue Jan 10 19:14:30 2006
New Revision: 367891
URL: http://svn.apache.org/viewcvs?rev=367891&view=rev
Log:
Improved patch for IBATISNET-100 to not throw a NullReferenceException if a cacheModel has a flushOnExecute node that references an invalid statement. A WARN message is issued instead (this may need to change to throwing a ConfigurationException). Thanks to Chad Humphries for discovering this.
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs?rev=367891&r1=367890&r2=367891&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs Tue Jan 10 19:14:30 2006
@@ -824,15 +824,28 @@
{
foreach (string statementName in statementsToRegister)
{
- CacheModel cacheModel = _configScope.SqlMapper.GetCache(cacheModelId);
- IMappedStatement mappedStatement = (IMappedStatement)_configScope.SqlMapper.MappedStatements[statementName];
+ IMappedStatement mappedStatement = _configScope.SqlMapper.MappedStatements[statementName] as IMappedStatement;
- if (_logger.IsDebugEnabled)
+ if (mappedStatement != null)
{
- _logger.Debug("Registering trigger statement [" + mappedStatement.Id + "] to cache model [" + cacheModel.Id + "]");
+ CacheModel cacheModel = _configScope.SqlMapper.GetCache(cacheModelId);
+
+ if (_logger.IsDebugEnabled)
+ {
+ _logger.Debug("Registering trigger statement [" + mappedStatement.Id + "] to cache model [" + cacheModel.Id + "]");
+ }
+
+ cacheModel.RegisterTriggerStatement(mappedStatement);
}
+ else
+ {
+ if (_logger.IsWarnEnabled)
+ {
+ _logger.Warn("Unable to register trigger statement [" + statementName + "] to cache model [" + cacheModelId + "]. Statement does not exist. Removing statement from list of valid statements.");
+ }
- cacheModel.RegisterTriggerStatement(mappedStatement);
+ _configScope.SqlMapper.MappedStatements.Remove(statementName);
+ }
}
}
}