[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Tue May 18 21:46:02 UTC 2004


CVS commit by okellogg: 

load(): Do not crash on a failed addOperation().
Thanks to Andrey Kravchuk for his boss2.xmi file which exposes the problem.


  M +16 -4     classifier.cpp   1.40


--- kdesdk/umbrello/umbrello/classifier.cpp  #1.39:1.40
@@ -73,7 +73,14 @@ UMLOperation * UMLClassifier::checkOpera
 bool UMLClassifier::addOperation(UMLOperation* op, int position )
 {
-        if( m_OpsList.findRef( op ) != -1  ||
-            checkOperationSignature(op->getName(), op->getParmList()) )
+        if (m_OpsList.findRef(op) != -1) {
+                kdDebug() << "UMLClassifier::addOperation: findRef("
+                          << op->getName() << ") finds op (bad)"
+                          << endl;
+                return false;
+        } else if (checkOperationSignature(op->getName(), op->getParmList()) ) {
+                kdDebug() << "UMLClassifier::addOperation: checkOperationSignature("
+                          << op->getName() << ") op is non-unique" << endl;
                 return false;
+        }
 
         if( op -> parent() )
@@ -359,7 +366,12 @@ bool UMLClassifier::load(QDomElement& el
                 } else if (tagEq(tag, "Operation")) {
                         UMLOperation* op = new UMLOperation(NULL);
-                        if( !op->loadFromXMI(element) ||
-                            !this->addOperation(op) ) {
+                        if (!op->loadFromXMI(element)) {
+                                kdError() << "UMLClassifier::load: error from op->loadFromXMI()"
+                                          << endl;
                                 delete op;
+                                return false;
+                        } else if (!this->addOperation(op) ) {
+                                kdError() << "UMLClassifier::load: error from this->addOperation(op)"
+                                          << endl;
                                 //return false;
                                 // Returning false here will spoil the entire






More information about the umbrello-devel mailing list