Update of /cvsroot/jcframework/dotnet
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4492
Modified Files:
CInjectedObject.vb
Log Message:
Improved exception message when class is incorrectly mapped (for injected objects)
Index: CInjectedObject.vb
===================================================================
RCS file: /cvsroot/jcframework/dotnet/CInjectedObject.vb,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- CInjectedObject.vb 14 Mar 2005 03:21:48 -0000 1.17
+++ CInjectedObject.vb 17 Mar 2005 06:14:36 -0000 1.18
@@ -469,7 +469,7 @@
Return CType(CallByName(o, propertyName, CallType.Get), IList)
End If
Catch err As Exception
- Throw New Exception("getCollectionByAttribute failed", err)
+ Throw New Exception("getCollectionByAttribute failed for attribute " & pName & " in " & m_object.GetType.FullName, err)
End Try
End Function
@@ -480,27 +480,31 @@
Dim pbroker As CPersistenceBroker
dotPos = pName.IndexOf(".")
- If dotPos = -1 Then
- obj = CallByName(m_object, pName, CallType.Get)
- Else
- Dim o As Object
- Dim objName As String
- Dim propertyName As String
- objName = pName.Substring(0, dotPos)
- propertyName = pName.Substring(dotPos + 1)
- o = CallByName(m_object, objName, CallType.Get)
- If o Is Nothing Then
- Return Nothing
+ Try
+ If dotPos = -1 Then
+ obj = CallByName(m_object, pName, CallType.Get)
+ Else
+ Dim o As Object
+ Dim objName As String
+ Dim propertyName As String
+ objName = pName.Substring(0, dotPos)
+ propertyName = pName.Substring(dotPos + 1)
+ o = CallByName(m_object, objName, CallType.Get)
+ If o Is Nothing Then
+ Return Nothing
+ End If
+ obj = CallByName(o, propertyName, CallType.Get)
End If
- obj = CallByName(o, propertyName, CallType.Get)
- End If
- If obj Is Nothing Then Return Nothing
- If obj.GetType.IsSubclassOf(GetType(IPersistableObject)) Then
- injobj = CType(obj, CInjectedObject)
- Else
- pbroker = getPersistenceBrokerInstance()
- injobj = pbroker.getInjectedObject(obj)
- End If
+ If obj Is Nothing Then Return Nothing
+ If obj.GetType.IsSubclassOf(GetType(IPersistableObject)) Then
+ injobj = CType(obj, CInjectedObject)
+ Else
+ pbroker = getPersistenceBrokerInstance()
+ injobj = pbroker.getInjectedObject(obj)
+ End If
+ Catch err As Exception
+ Throw New Exception("getObjectByAttribute failed for attribute " & pName & " in " & m_object.GetType.FullName, err)
+ End Try
Return injobj
End Function
|