[ http://issues.apache.org/jira/browse/IBATISNET-67?page=all ] Gilles Bayon closed IBATISNET-67: ---------------------------------
Resolution: Fixed Fix Version: DataMapper 1.2 In SVN > IBatisNet.Common.Utilities.Resources.GetConfigAsXmlDocument(string) doesn't > attempt to close its XmlTextReader when an exception is thrown while parsing > the SqlMap.config file > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: IBATISNET-67 > URL: http://issues.apache.org/jira/browse/IBATISNET-67 > Project: iBatis for .NET > Type: Bug > Reporter: Ron Grabowski > Assignee: Gilles Bayon > Fix For: DataMapper 1.2 > > As of 5/20/2005, if an exception is thrown while trying to parse > SqlMap.config (note the incorrect closing XML comment tag): > <!-- > <sqlMap embedded="Resources.SqlMaps.Foo.xml, Company.Project.Data"/> > -> > the underlying XmlTextReader is not closed. On XP/IIS, the SqlMap.config file > becomes locked by aspnet_wp.exe and the webserver needs to be restarted. This > code: > public static XmlDocument GetConfigAsXmlDocument(string fileName) > { > XmlDocument config = new XmlDocument(); > try > { > XmlTextReader reader = new XmlTextReader(Path.Combine(_baseDirectory, > fileName)); > config.Load(reader); > reader.Close(); // <--- NEVER CALLED IF AN EXCEPTION IS THROWN > } > catch(Exception e) > { > throw new ConfigurationException( > string.Format("Unable to load config file \"{0}\". Cause : ", > fileName, > e.Message ) ,e); > } > return config; > } > Needs to be changed to this: > public static XmlDocument GetConfigAsXmlDocument(string fileName) > { > XmlDocument config = new XmlDocument(); > XmlTextReader reader = null; > try > { > reader = new XmlTextReader(Path.Combine(_baseDirectory, fileName)); > config.Load(reader); > } > catch(Exception e) > { > throw new ConfigurationException( > string.Format("Unable to load config file \"{0}\". Cause : ", > fileName, > e.Message ) ,e); > } > finally > { > if (reader != null) > { > reader.Close(); > } > } > return config; > } > I searched all the files in the Common, DataAccess, and DataMapper projects > for "XmlTextReader" and everything else looks correct. -- 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