carliwar / sharp-architecture

Automatically exported from code.google.com/p/sharp-architecture
Other
0 stars 0 forks source link

NHibernateSession.Init() is not exception safe #137

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If an exception is thrown from NHibernateSession.AddConfiguration(), the
Storage property will not be reset to null. With the checks in
InitStorage(), Init() can't be called again with corrected parameters.

A fix is to change Init body to:

            InitStorage(storage);
            try
            {
                return AddConfiguration(DefaultFactoryKey,
mappingAssemblies, autoPersistenceModel, cfgFile, cfgProperties,
validatorCfgFile, persistenceConfigurer);
            }
            catch (Exception)
            {
                Storage = null;
                throw;
            }

Original issue reported on code.google.com by danielnu...@gmail.com on 10 Nov 2009 at 10:40