svn commit: r14359 - trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-04-15 21:11:42-0700
New Revision: 14359

Modified:
   trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java

Log:
Protect against NPE

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java?view=diff&rev=14359&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java&r1=14358&r2=14359
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/CoreHelperMDRImpl.java	2008-04-15 21:11:42-0700
@@ -1433,7 +1433,13 @@
     private boolean isValidNamespace(UmlAssociation assoc, Namespace ns) {
         List<Namespace> namespaces = new ArrayList<Namespace>();
         for (AssociationEnd end : assoc.getConnection()) {
-            namespaces.add(end.getParticipant().getNamespace());
+            Classifier participant = end.getParticipant();
+            if (participant != null) {
+                Namespace namespace = participant.getNamespace();
+                if (namespace != null) {
+                    namespaces.add(namespace);
+                }
+            }
         }
         if (namespaces.size() < 2) {
             return false;
@@ -1442,6 +1448,7 @@
         Namespace ns2 = namespaces.get(1);
         // TODO: This is incorrect.  AssociationEnds must be
         // visible from Association's namespace, not vice versa. - tfm
+        // This is also assuming a binary association
         if (ns == getFirstSharedNamespace(ns1, ns2)) {
             return true;
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.