protected void castFireEvent(GwtEvent<?> event) { try { fireEvent((Event<?>) event); } catch (com.google.web.bindery.event.shared.UmbrellaException e) { throw new UmbrellaException(e.getCauses()); } }
protected void castFireEventFromSource(GwtEvent<?> event, Object source) { try { fireEventFromSource((Event<?>) event, source); } catch (com.google.web.bindery.event.shared.UmbrellaException e) { throw new UmbrellaException(e.getCauses()); } }
throw new UmbrellaException(e.getCauses()); } finally { if (oldSource == null) {
protected void castFireEventFromSource(GwtEvent<?> event, Object source) { try { fireEventFromSource((Event<?>) event, source); } catch (com.google.web.bindery.event.shared.UmbrellaException e) { throw new UmbrellaException(e.getCauses()); } }
protected void castFireEvent(GwtEvent<?> event) { try { fireEvent((Event<?>) event); } catch (com.google.web.bindery.event.shared.UmbrellaException e) { throw new UmbrellaException(e.getCauses()); } }
protected void castFireEventFromSource(GwtEvent<?> event, Object source) { try { fireEventFromSource((Event<?>) event, source); } catch (com.google.web.bindery.event.shared.UmbrellaException e) { throw new UmbrellaException(e.getCauses()); } }
protected void castFireEvent(GwtEvent<?> event) { try { fireEvent((Event<?>) event); } catch (com.google.web.bindery.event.shared.UmbrellaException e) { throw new UmbrellaException(e.getCauses()); } }
causes = new HashSet<Throwable>(); causes.addAll(e.getCauses());
public void testReentrantEventsAreFiredIfThereWasAnException() { final SimplerEventBus reg = new SimplerEventBus(); // a flag to make our first handler cause a reentrant event final boolean fireAgain[] = { true }; final List<Integer> orderOfFires = new ArrayList<Integer>(); // setup 1st handler that will conditionally be reentrant reg.addHandler(ClickEvent.getType(), new ClickHandler() { public void onClick(ClickEvent arg0) { // make a reentrant event, e.g. a change handler caused another change event orderOfFires.add(1); if (fireAgain[0]) { fireAgain[0] = false; fireClickEvent(reg); } } }); // setup 2nd handler to fail reg.addHandler(ClickEvent.getType(), new ClickHandler() { public void onClick(ClickEvent arg0) { throw new RuntimeException("failed"); } }); try { fireClickEvent(reg); } catch (UmbrellaException r) { assertThat(r.getMessage(), is("2 exceptions caught: failed; failed")); assertThat(r.getCauses().size(), is(2)); } assertThat(orderOfFires, contains(1, 1)); }
throw new UmbrellaException(e.getCauses()); } finally { if (oldSource == null) {
throw new UmbrellaException(e.getCauses()); } finally { if (oldSource == null) {
throw new UmbrellaException(e.getCauses()); } finally { if (oldSource == null) {
throw new UmbrellaException(e.getCauses()); } finally { if (oldSource == null) {
public void testHandlersThrow() { RuntimeException exception1 = new RuntimeException("first exception"); RuntimeException exception2 = new RuntimeException("second exception"); final SimplerEventBus eventBus = new SimplerEventBus(); eventBus.addHandler(MouseDownEvent.getType(), mouse1); eventBus.addHandler(MouseDownEvent.getType(), new ThrowingHandler(exception1)); eventBus.addHandler(MouseDownEvent.getType(), mouse2); eventBus.addHandler(MouseDownEvent.getType(), new ThrowingHandler(exception2)); eventBus.addHandler(MouseDownEvent.getType(), mouse3); MouseDownEvent event = new MouseDownEvent() { }; try { eventBus.fireEvent(event); fail("eventBus should have thrown"); } catch (UmbrellaException e) { Set<Throwable> causes = e.getCauses(); assertEquals("Exception should wrap the two thrown exceptions", 2, causes.size()); assertTrue("First exception should be under the umbrella", causes.contains(exception1)); assertTrue("Second exception should be under the umbrella", causes.contains(exception2)); } /* * Exception should not have prevented all three mouse handlers from getting * the event. */ assertFired(mouse1, mouse2, mouse3); }