[Mobies-commit] [commit] r4256 - UDM/trunk/src/UML GME/Interpreter

ksmyth at redhat3.isis.vanderbilt.edu ksmyth at redhat3.isis.vanderbilt.edu
Tue Mar 4 15:34:58 CST 2014


Author: ksmyth
Date: Tue Mar  4 15:34:58 2014
New Revision: 4256

Log:
Uml2Xml: fix crash in UMT with CrossLinks not under a package

Modified:
   UDM/trunk/src/UML GME/Interpreter/BONComponent.cpp
   UDM/trunk/src/UML GME/Interpreter/BONComponent.h

Modified: UDM/trunk/src/UML GME/Interpreter/BONComponent.cpp
==============================================================================
--- UDM/trunk/src/UML GME/Interpreter/BONComponent.cpp	Tue Mar  4 15:34:47 2014	(r4255)
+++ UDM/trunk/src/UML GME/Interpreter/BONComponent.cpp	Tue Mar  4 15:34:58 2014	(r4256)
@@ -1058,6 +1058,10 @@
 	else
 	{
         CPackageBuilder *ass_package = assoc->GetPackage();
+		if (!ass_package)
+		{
+			throw int_exception(assoc->path + " must be contained in a Namespace or Package");
+		}
 		ass_package->AddAssociation(assoc);
 	}
 }
@@ -1459,6 +1463,7 @@
 
 void CDirectAssociationBuilder::SetSourceAndDestination(CCompositeClass *s,CCompositeClass *d)
 {
+	GetExtendedName(path, "/", true);
 	source.cls = s;
 	dest.cls = d;
 	associationClass = 0;
@@ -1496,9 +1501,22 @@
 	if(assClasses.GetCount() > 1)
 		AfxMessageBox("Multiple association classes defined for association!");
 	else if(!assClasses.IsEmpty()) {
-		CClassBase *cls = dynamic_cast<CClassBase *>(assClasses.GetHead());
+		CBuilderObject* assClass = assClasses.GetHead();
+		CClassBase *cls = dynamic_cast<CClassBase *>(assClass);
+		if (!cls)
+		{
+			CString path;
+			assClass->GetExtendedName(path, "/", true);
+			throw int_exception(path + " must be an association class");
+		}
 		ASSERT(cls);
 		associationClass = cls->GetComposite();
+		if (!associationClass)
+		{
+			CString path;
+			assClass->GetExtendedName(path, "/", true);
+			throw int_exception(path + " must be an association class"); // FIXME this error message is wrong
+		}
 		associationClass->SetAssociation(this);
 		association = associationClass->GetName();
 	}

Modified: UDM/trunk/src/UML GME/Interpreter/BONComponent.h
==============================================================================
--- UDM/trunk/src/UML GME/Interpreter/BONComponent.h	Tue Mar  4 15:34:47 2014	(r4255)
+++ UDM/trunk/src/UML GME/Interpreter/BONComponent.h	Tue Mar  4 15:34:58 2014	(r4256)
@@ -109,7 +109,7 @@
     	static CComponent *theInstance;
     public:
     
-  		int  GatherPackageFolders(CBuilderFolder *folder,CPackageBuilderList &packages);
+		int GatherPackageFolders(CBuilderFolder *folder,CPackageBuilderList &packages);
 		::Uml::Diagram& GetCrossUmlDiagram() { return cross_uml_dgr; };
 
 	protected:
@@ -347,6 +347,7 @@
 		::Uml::Association cross_uml_ass;
 		void _BuildUML(::Uml::Association &ass, bool is_cross);
     public:
+		CString path;
     	bool IsEquivalent(CAssociationBase *ass);
     	bool IsCrossPackage();
     	virtual void SetSourceAndDestination(CCompositeClass *s,CCompositeClass *d) = 0;


More information about the Mobies-commit mailing list