Skip to content

Commit 73868e1

Browse files
committed
Don't throw then catch exception in Component if no componentClassName was set.
1 parent 22165b0 commit 73868e1

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/NHibernate/Mapping/Component.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,26 +133,26 @@ public System.Type ComponentClass
133133
get
134134
{
135135
// NH Different implementation (we use reflection only when needed)
136-
if (componentClass == null)
136+
if (componentClass != null) return componentClass;
137+
if (componentClassName == null) return null;
138+
139+
try
137140
{
138-
try
139-
{
140-
componentClass = ReflectHelper.ClassForName(componentClassName);
141-
}
142-
catch (Exception cnfe)
143-
{
144-
if (!IsDynamic) // TODO remove this if leave the Exception
145-
throw new MappingException("component class not found: " + componentClassName, cnfe);
146-
return null;
147-
}
141+
componentClass = ReflectHelper.ClassForName(componentClassName);
142+
}
143+
catch (Exception cnfe)
144+
{
145+
if (!IsDynamic) // TODO remove this if leave the Exception
146+
throw new MappingException("component class not found: " + componentClassName, cnfe);
147+
return null;
148148
}
149149
return componentClass;
150150
}
151151
set // TODO NH: Remove the setter
152152
{
153153
componentClass = value;
154-
if (componentClass != null)
155-
componentClassName = componentClass.AssemblyQualifiedName;
154+
if (value != null)
155+
componentClassName = value.AssemblyQualifiedName;
156156
}
157157
}
158158

0 commit comments

Comments
 (0)