svn commit: r14538 - trunk/src/argouml-app/src/org/argouml/util/ItemUID.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-04-30 14:54:21-0700
New Revision: 14538

Modified:
   trunk/src/argouml-app/src/org/argouml/util/ItemUID.java

Log:
Fix failing tests and add comments

Modified: trunk/src/argouml-app/src/org/argouml/util/ItemUID.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/util/ItemUID.java?view=diff&rev=14538&p1=trunk/src/argouml-app/src/org/argouml/util/ItemUID.java&p2=trunk/src/argouml-app/src/org/argouml/util/ItemUID.java&r1=14537&r2=14538
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/util/ItemUID.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/util/ItemUID.java	2008-04-30 14:54:21-0700
@@ -162,16 +162,22 @@
         }
 
         if (obj instanceof IItemUID) {
-            return ((IItemUID) obj).getItemUID().toString();
+            final ItemUID itemUid = ((IItemUID) obj).getItemUID();
+            return (itemUid == null ? null : itemUid.toString());
         }
 	Object rv;
 	try {
+	    // TODO: We shouldn't need this reflection any more once we have
+	    // convinced ourselves that everything with a getItemUID method
+	    // is implementing IItemUID
 	    Method m = obj.getClass().getMethod("getItemUID", (Class[]) null);
 	    rv = m.invoke(obj, (Object[]) null);
 	} catch (NoSuchMethodException nsme) {
 	    // Apparently this object had no getItemUID
 	    try {
                 // This is needed for a CommentEdge ...
+                // TODO: Why doesn't CommentEdge implement IItemUID and be
+	        // handled with the mechanism above.
 	        Method m = obj.getClass().getMethod("getUUID", (Class[]) null);
 	        rv = m.invoke(obj, (Object[]) null);
                 return (String) rv;
@@ -254,6 +260,9 @@
 	Object[] mparam;
 	params[0] = MYCLASS;
 	try {
+            // TODO: We shouldn't need this reflection any more once we have
+            // convinced ourselves that everything with a setItemUID method
+            // is implementing IItemUID
 	    Method m = obj.getClass().getMethod("setItemUID", params);
 	    mparam = new Object[1];
 	    mparam[0] = new ItemUID();
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.