incubator-ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ange...@apache.org
Subject svn commit: r821424 - /incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java
Date Sat, 03 Oct 2009 21:41:10 GMT
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));
+                }
+            });
+        }
     }
     
     /**



Mime
View raw message