You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by an...@apache.org on 2009/10/03 23:41:10 UTC

svn commit: r821424 - /incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java

Author: angelos
Date: Sat Oct  3 21:41:10 2009
New Revision: 821424

URL: http://svn.apache.org/viewvc?rev=821424&view=rev
Log:
ACE-41 Now we don't have a selection per se when creating associations, we introduced the opportunity for an NPE when updating highlights; introduced a null check for that.

Modified:
    incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java?rev=821424&r1=821423&r2=821424&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java Sat Oct  3 21:41:10 2009
@@ -19,6 +19,7 @@
 package org.apache.ace.client;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -184,15 +185,22 @@
      * Triggers the updating of the highlight
      */
     void updateHighlight() {
-        m_assocationService.getRelated(getSelectedObject(), new AsyncCallback<Descriptor[]>() {
-            public void onFailure(Throwable caught) {
-                // Too bad...
-                Window.alert("Error updating highlights: " + caught);
-            }
-            public void onSuccess(Descriptor[] result) {
-                highlight(Arrays.asList(result));
-            }
-        });
+        Descriptor selected = getSelectedObject();
+        if (selected == null) {
+            List<Descriptor> emptyList = Collections.emptyList();
+            highlight(emptyList);
+        }
+        else {
+            m_assocationService.getRelated(selected, new AsyncCallback<Descriptor[]>() {
+                public void onFailure(Throwable caught) {
+                    // Too bad...
+                    Window.alert("Error updating highlights: " + caught);
+                }
+                public void onSuccess(Descriptor[] result) {
+                    highlight(Arrays.asList(result));
+                }
+            });
+        }
     }
     
     /**