[ http://jira.nhibernate.org/browse/NH-693?page=comments#action_14379 ]
Dru Sellers commented on NH-693:
--------------------------------
The issue is if the user forgets to supply a table name.
table=""
we throw a NHibernate.MappingException: Index was outside the bounds of the array instead of a "you forgot to tell us the table name" exception.
NHibernate.Mapping.Table.set_Name - Line 89
If a string "" is passed in there is no string.IsEmptyOrNull type check.
NHibernate.Cfg.Mappings.AddTable(String schema, String name)
Once again there is no check for empty or null strings.
I have attached a unit test.
> Better Error Msg
> ----------------
>
> Key: NH-693
> URL: http://jira.nhibernate.org/browse/NH-693
> Project: NHibernate
> Type: Improvement
> Components: Core
> Reporter: Dru Sellers
> Priority: Minor
>
> Can we have better error msg for this error?
> "NHibernate.MappingException: Index was outside the bounds of the array. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
> at NHibernate.Mapping.Table.set_Name(String value)
> at NHibernate.Cfg.Mappings.AddTable(String schema, String name)
> at NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
> at NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
> at NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)
> at NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader)
> at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
> --- End of inner exception stack trace ---
> at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
> at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering)
> at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
> at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
> I would be happy to code it up, but not sure where to best put the check?
> NHibernate.Mapping.Table.set_Name (least amount of code repeat.)
> or
> NHibernate.Cfg.Mappings.AddTable(String schema, String name) best place to provide the most info possible. Actually this is a bad place too.
> --Thoughts?--
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nhibernate.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
|