geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r702403 - /geronimo/gshell/trunk/gshell-support/gshell-event/src/main/java/org/apache/geronimo/gshell/event/EventAdapter.java
Date Tue, 07 Oct 2008 09:09:21 GMT
Author: jdillon
Date: Tue Oct  7 02:09:21 2008
New Revision: 702403

URL: http://svn.apache.org/viewvc?rev=702403&view=rev
Log:
Avoid eating an CCE which occurs after the initial cast

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-event/src/main/java/org/apache/geronimo/gshell/event/EventAdapter.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-event/src/main/java/org/apache/geronimo/gshell/event/EventAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-event/src/main/java/org/apache/geronimo/gshell/event/EventAdapter.java?rev=702403&r1=702402&r2=702403&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-event/src/main/java/org/apache/geronimo/gshell/event/EventAdapter.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-event/src/main/java/org/apache/geronimo/gshell/event/EventAdapter.java
Tue Oct  7 02:09:21 2008
@@ -29,11 +29,17 @@
 {
     @SuppressWarnings({"unchecked"})
     public void onEvent(final Event event) throws Exception {
+        T targetEvent = null;
+
         // HACK: Can't check the type from T, so just handle the CCE, might not be very efficent
though :-(
         try {
-            handleEvent((T)event);    
+            targetEvent = (T)event;
         }
         catch (ClassCastException ignore) {}
+
+        if (targetEvent != null) {
+            handleEvent(targetEvent);
+        }
     }
 
     protected abstract void handleEvent(T event) throws Exception;



Mime
View raw message