Examples of ExceptionToCatchEvent


Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

    @Inject
    private BeanManager beanManager;

    public void broadcastAccessDeniedException(AccessDeniedException accessDeniedException)
    {
        ExceptionToCatchEvent exceptionToCatchEvent = new ExceptionToCatchEvent(accessDeniedException);

        try
        {
            this.beanManager.fireEvent(exceptionToCatchEvent);
        }
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

     * @param originalException exception thrown by an authorizer
     * @return the original exception if the default behavior was changed and the exception is unhandled
     */
    protected RuntimeException handleAccessDeniedException(AccessDeniedException originalException)
    {
        ExceptionToCatchEvent exceptionToCatchEvent = new ExceptionToCatchEvent(originalException);
        this.beanManager.fireEvent(exceptionToCatchEvent);
        //the next step won't happen per default since ExceptionHandlerBroadcaster will throw the exception,
        //because BeforeAccessDeniedExceptionHandler calls #throwOriginal
        //but allows to suppress it via deactivating BeforeAccessDeniedExceptionHandler
        //(or a 2nd @BeforeHandles method which overrules the default behavior
        //(if needed)
        if (!exceptionToCatchEvent.isHandled())
        {
            throw originalException;
        }

        return null;
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

            while (iterator.hasNext())
            {
                Throwable throwable = iterator.next().getContext().getException();
                Throwable rootCause = getRootCause(throwable);

                ExceptionToCatchEvent event = new ExceptionToCatchEvent(rootCause, exceptionQualifier);
                event.setOptional(true);

                beanManager.fireEvent(event);

                if (event.isHandled())
                {
                    iterator.remove();
                }

                // a handle method might redirect and set responseComplete
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

            if (facesContext.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE &&
                exceptionQueuedEvent.getContext().inBeforePhase())
            {
                Throwable exception = getRootCause(exceptionQueuedEvent.getContext().getException());

                ExceptionToCatchEvent exceptionToCatchEvent = new ExceptionToCatchEvent(exception);
                exceptionToCatchEvent.setOptional(true);

                this.beanManager.fireEvent(exceptionToCatchEvent);

                if (exceptionToCatchEvent.isHandled())
                {
                    return;
                }
            }
        }
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

    private BeanManager bm;

    @Test(expected = UnsupportedOperationException.class)
    public void assertOutboundRethrow()
    {
        bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));
    }
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

    }

    @Test(expected = UnsupportedOperationException.class)
    public void assertInboundRethrow()
    {
        bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
    }
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

    }

    @Test
    public void assertNoOtherHandlersCalledAfterAbort()
    {
        bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));
        assertTrue(abortingDepthHandler.isAbortCalled());
        assertFalse(abortingDepthHandler.isProceedCalled());
    }
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

    private BeanManager bm;

    @Test
    public void assertCorrectNumberOfHandlerCallsForProceedCause()
    {
        bm.fireEvent(new ExceptionToCatchEvent(new Exception(new IllegalArgumentException(new NullPointerException()))));
        assertEquals(0, proceedCauseHandler.getBreadthFirstNpeLowerPrecedenceCalled());
        assertEquals(1, proceedCauseHandler.getBreadthFirstNpeCalled());

        assertEquals(0, proceedCauseHandler.getDepthFirstNpeHigherPrecedenceCalled());
        assertEquals(0, proceedCauseHandler.getDepthFirstNpeCalled());
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

    private BeanManager bm;

    @Test
    public void assertNoHandlersAfterHandledAreCalled()
    {
        final ExceptionToCatchEvent entryEvent = new ExceptionToCatchEvent(new Exception(
                new NullPointerException()));
        bm.fireEvent(entryEvent);
        assertTrue(exceptionHandledHandler.isNpeDescCalled());
        assertFalse(exceptionHandledHandler.isExAscCalled());
        assertTrue(entryEvent.isHandled());
    }
View Full Code Here

Examples of org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent

    }

    @Test
    public void assertNoHandlersAfterHandledAreCalledDesc()
    {
        final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new Exception(new IllegalArgumentException()));
        bm.fireEvent(event);
        assertTrue(exceptionHandledHandler.isIaeAscCalled());
        assertFalse(exceptionHandledHandler.isExAscCalled());
        assertTrue(event.isHandled());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.