svn commit: r16136 - trunk/src/argouml-app/src/org/argouml/ui/explorer/DnDExplorerTree.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-11-22 07:44:23-0800
New Revision: 16136

Modified:
   trunk/src/argouml-app/src/org/argouml/ui/explorer/DnDExplorerTree.java

Log:
Protect against NullPointerException - mainly for debug logging

Modified: trunk/src/argouml-app/src/org/argouml/ui/explorer/DnDExplorerTree.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/explorer/DnDExplorerTree.java?view=diff&rev=16136&p1=trunk/src/argouml-app/src/org/argouml/ui/explorer/DnDExplorerTree.java&p2=trunk/src/argouml-app/src/org/argouml/ui/explorer/DnDExplorerTree.java&r1=16135&r2=16136
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/explorer/DnDExplorerTree.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/explorer/DnDExplorerTree.java	2008-11-22 07:44:23-0800
@@ -690,10 +690,17 @@
             /* If the destination is not a NameSpace, then reject: */
             if (!Model.getFacade().isANamespace(dest)) {
                 if (LOG.isDebugEnabled()) {
+                    String name;
+                    if (Model.getFacade().isAUMLElement(dest)) {
+                        name = Model.getFacade().getName(dest);
+                    } else if (dest == null) {
+                        name = "<null>";
+                    } else {
+                        name = dest.toString();
+                    }
                     LOG.debug("No valid Drag: "
                             + (Model.getFacade().isAUMLElement(dest) 
-                                    ? Model.getFacade().getName(dest)
-                                            + " not a namespace."
+                                    ? name + " not a namespace."
                                     :  " not a UML element."));
                 }
                 dropTargetDragEvent.rejectDrag();
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.