Skip to content

Commit

Permalink
Renaming ExceptionToCatchEvent -> ExceptionToCatch
Browse files Browse the repository at this point in the history
  • Loading branch information
LightGuard committed Dec 1, 2010
1 parent 78866f2 commit ea0bcc6
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 36 deletions.
Expand Up @@ -26,7 +26,7 @@
* Entry point event into the Catch system. This object is nearly immutable, the only mutable portion
* is the handled flag.
*/
public class ExceptionToCatchEvent
public class ExceptionToCatch
{
private final Throwable exception;
private boolean handled;
Expand All @@ -39,7 +39,7 @@ public class ExceptionToCatchEvent
* @param exception Exception to handle
* @param qualifiers qualifiers to use to narrow the handlers called
*/
public ExceptionToCatchEvent(Throwable exception, Annotation... qualifiers)
public ExceptionToCatch(Throwable exception, Annotation... qualifiers)
{
this.exception = exception;
this.qualifiers = new HashSet<Annotation>();
Expand All @@ -51,7 +51,7 @@ public ExceptionToCatchEvent(Throwable exception, Annotation... qualifiers)
*
* @param exception Exception to handle.
*/
public ExceptionToCatchEvent(Throwable exception)
public ExceptionToCatch(Throwable exception)
{
this.exception = exception;
this.qualifiers = Collections.emptySet();
Expand Down
Expand Up @@ -26,7 +26,7 @@
import javax.ws.rs.ext.Provider;

import org.jboss.seam.exception.control.CatchResource;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;

/**
* A JAX-RS ExceptionMapper implementation that maps all exceptions (i.e.,
Expand All @@ -35,7 +35,7 @@
* <p/>
* <p>
* Exceptions are send to Seam Catch by firing an event of type
* {@link ExceptionToCatchEvent} to the CDI event bus. The event payload
* {@link ExceptionToCatch} to the CDI event bus. The event payload
* contains the exception and the qualifier &#064;RestRequest. The qualifier
* allows handlers that deal specifically with REST requests to be selected.
* </p>
Expand All @@ -50,11 +50,11 @@ public class CatchExceptionMapper implements ExceptionMapper<Throwable>
private Instance<Response> responseProvider;

@Inject
private Event<ExceptionToCatchEvent> bridgeEvent;
private Event<ExceptionToCatch> bridgeEvent;

public Response toResponse(Throwable exception)
{
bridgeEvent.fire(new ExceptionToCatchEvent(exception, RestRequestLiteral.INSTANCE));
bridgeEvent.fire(new ExceptionToCatch(exception, RestRequestLiteral.INSTANCE));
return responseProvider.get();
}
}
Expand Up @@ -30,7 +30,7 @@
import org.jboss.seam.exception.control.extension.CatchExtension;

/**
* Observer of {@link org.jboss.seam.exception.control.ExceptionToCatchEvent} events and handler dispatcher.
* Observer of {@link ExceptionToCatch} events and handler dispatcher.
* All handlers are invoked from this class. This class is immutable.
*/
public class ExceptionHandlerDispatch
Expand All @@ -45,7 +45,7 @@ public class ExceptionHandlerDispatch
* @throws Throwable If a handler requests the exception to be re-thrown.
*/
@SuppressWarnings({"unchecked", "MethodWithMultipleLoops", "ThrowableResultOfMethodCallIgnored"})
public void executeHandlers(@Observes ExceptionToCatchEvent eventException, final BeanManager bm,
public void executeHandlers(@Observes ExceptionToCatch eventException, final BeanManager bm,
CatchExtension extension) throws Throwable
{
final Stack<Throwable> unwrappedExceptions = new Stack<Throwable>();
Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.extension.CatchExtension;
import org.jboss.seam.exception.control.test.handler.CalledExceptionHandler;
import org.jboss.shrinkwrap.api.Archive;
Expand Down Expand Up @@ -56,7 +56,7 @@ public static Archive<?> createTestArchive()
@Test
public void assertOutboundHanldersAreCalled()
{
bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
bm.fireEvent(new ExceptionToCatch(new IllegalArgumentException()));

assertTrue(CalledExceptionHandler.OUTBOUND_HANDLER_CALLED);
}
Expand All @@ -65,29 +65,29 @@ public void assertOutboundHanldersAreCalled()
public void assertOutboundHanldersAreCalledOnce()
{
CalledExceptionHandler.OUTBOUND_HANDLER_TIMES_CALLED = 0;
bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
bm.fireEvent(new ExceptionToCatch(new IllegalArgumentException()));
assertEquals(1, CalledExceptionHandler.OUTBOUND_HANDLER_TIMES_CALLED);
}

@Test
public void assertInboundHanldersAreCalledOnce()
{
CalledExceptionHandler.INBOUND_HANDLER_TIMES_CALLED = 0;
bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
bm.fireEvent(new ExceptionToCatch(new IllegalArgumentException()));
assertEquals(1, CalledExceptionHandler.INBOUND_HANDLER_TIMES_CALLED);
}

@Test
public void assertAdditionalParamsAreInjected()
{
bm.fireEvent(new ExceptionToCatchEvent(new RuntimeException(new IllegalArgumentException())));
bm.fireEvent(new ExceptionToCatch(new RuntimeException(new IllegalArgumentException())));
assertTrue(CalledExceptionHandler.BEANMANAGER_INJECTED);
}

@Test
public void assertProtectedHandlersAreCalled()
{
bm.fireEvent(new ExceptionToCatchEvent(new IllegalStateException()));
bm.fireEvent(new ExceptionToCatch(new IllegalStateException()));
assertTrue(CalledExceptionHandler.PROTECTED_HANDLER_CALLED);
}
}
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.Handles;
import org.jboss.seam.exception.control.HandlesExceptions;
import org.jboss.seam.exception.control.TraversalPath;
Expand Down Expand Up @@ -59,7 +59,7 @@ public static Archive<?> createTestArchive()
@Test
public void assertEventIsCreatedCorrectly()
{
bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));
bm.fireEvent(new ExceptionToCatch(new NullPointerException()));
}

public void verifyDescEvent(@Handles(during = TraversalPath.DESCENDING) CaughtException<NullPointerException> event)
Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.extension.CatchExtension;
import org.jboss.seam.exception.control.test.handler.ExceptionHandledHandler;
import org.jboss.shrinkwrap.api.Archive;
Expand Down Expand Up @@ -55,18 +55,18 @@ public static Archive<?> createTestArchive()
@Test
public void assertNoHandlersAfterHandledAreCalled()
{
final ExceptionToCatchEvent catchEntryEvent = new ExceptionToCatchEvent(new Exception(
final ExceptionToCatch catchEntry = new ExceptionToCatch(new Exception(
new NullPointerException()));
bm.fireEvent(catchEntryEvent);
bm.fireEvent(catchEntry);
assertTrue(ExceptionHandledHandler.NPE_DESC_CALLED);
assertFalse(ExceptionHandledHandler.EX_ASC_CALLED);
assertTrue(catchEntryEvent.isHandled());
assertTrue(catchEntry.isHandled());
}

@Test
public void assertNoHandlersAfterHandledAreCalledDesc()
{
final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new Exception(new IllegalArgumentException()));
final ExceptionToCatch event = new ExceptionToCatch(new Exception(new IllegalArgumentException()));
bm.fireEvent(event);
assertTrue(ExceptionHandledHandler.IAE_ASC_CALLED);
assertFalse(ExceptionHandledHandler.EX_ASC_CALLED);
Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.extension.CatchExtension;
import org.jboss.seam.exception.control.test.handler.AbortingInboundHandler;
import org.jboss.shrinkwrap.api.Archive;
Expand Down Expand Up @@ -55,7 +55,7 @@ public static Archive<?> createTestArchive()
@Test
public void assertNoOtherHandlersCalledAfterAbort()
{
bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));
bm.fireEvent(new ExceptionToCatch(new NullPointerException()));
assertTrue(AbortingInboundHandler.abortCalled);
assertFalse(AbortingInboundHandler.proceedCalled);
}
Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.extension.CatchExtension;
import org.jboss.seam.exception.control.test.handler.AbortingOutboundHandler;
import org.jboss.shrinkwrap.api.Archive;
Expand Down Expand Up @@ -55,7 +55,7 @@ public static Archive<?> createTestArchive()
@Test
public void assertNoOtherHandlersCalledAfterAbort()
{
bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));
bm.fireEvent(new ExceptionToCatch(new NullPointerException()));
assertTrue(AbortingOutboundHandler.abortCalled);
assertFalse(AbortingOutboundHandler.proceedCalled);
}
Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.extension.CatchExtension;
import org.jboss.seam.exception.control.test.handler.ProceedCauseHandler;
import org.jboss.shrinkwrap.api.Archive;
Expand Down Expand Up @@ -54,7 +54,7 @@ public static Archive<?> createTestArchive()
@Test
public void assertCorrectNumberOfHandlerCallsForProceedCause()
{
bm.fireEvent(new ExceptionToCatchEvent(new Exception(new IllegalArgumentException(new NullPointerException()))));
bm.fireEvent(new ExceptionToCatch(new Exception(new IllegalArgumentException(new NullPointerException()))));
assertEquals(0, ProceedCauseHandler.INBOUND_NPE_LOWER_PRECEDENCE_CALLED);
assertEquals(1, ProceedCauseHandler.INBOUND_NPE_CALLED);

Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.extension.CatchExtension;
import org.jboss.seam.exception.control.test.handler.RethrowHandler;
import org.jboss.shrinkwrap.api.Archive;
Expand Down Expand Up @@ -52,12 +52,12 @@ public static Archive<?> createTestArchive()
@Test(expected = NullPointerException.class)
public void assertOutboundRethrow()
{
bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));
bm.fireEvent(new ExceptionToCatch(new NullPointerException()));
}

@Test(expected = IllegalArgumentException.class)
public void assertInboundRethrow()
{
bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
bm.fireEvent(new ExceptionToCatch(new IllegalArgumentException()));
}
}
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.extension.CatchExtension;
import org.jboss.seam.exception.control.test.handler.StackInfoHandler;
import org.jboss.shrinkwrap.api.Archive;
Expand Down Expand Up @@ -53,7 +53,7 @@ public static Archive<?> createTestArchive()
@Test
public void assertStackInfoIsCorrect()
{
bm.fireEvent(new ExceptionToCatchEvent(new Exception(new NullPointerException())));
bm.fireEvent(new ExceptionToCatch(new Exception(new NullPointerException())));
}

}
Expand Up @@ -23,7 +23,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.ExceptionToCatchEvent;
import org.jboss.seam.exception.control.ExceptionToCatch;
import org.jboss.seam.exception.control.extension.CatchExtension;
import org.jboss.seam.exception.control.test.handler.UnMuteHandler;
import org.jboss.shrinkwrap.api.Archive;
Expand Down Expand Up @@ -55,7 +55,7 @@ public static Archive<?> createTestArchive()
@Test
public void assertCorrectNumberOfCallsForUnMute()
{
bm.fireEvent(new ExceptionToCatchEvent(new Exception(new NullPointerException())));
bm.fireEvent(new ExceptionToCatch(new Exception(new NullPointerException())));

assertEquals(2, UnMuteHandler.ASC_NUMBER_CALLED);
assertEquals(2, UnMuteHandler.DESC_NUMBER_CALLED);
Expand Down

0 comments on commit ea0bcc6

Please sign in to comment.