You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by li...@apache.org on 2014/06/17 20:57:56 UTC
[1/2] git commit: Looks like I missed one case.
Repository: deltaspike
Updated Branches:
refs/heads/master 21cf0a6b6 -> 91d09ca1d
Looks like I missed one case.
The tests now pass as expected.
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/91d09ca1
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/91d09ca1
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/91d09ca1
Branch: refs/heads/master
Commit: 91d09ca1d0978781d39620929a1ae64687b6388b
Parents: 9e66540
Author: Jason Porter <li...@apache.org>
Authored: Mon Jun 16 14:27:31 2014 -0600
Committer: Jason Porter <li...@apache.org>
Committed: Tue Jun 17 12:49:37 2014 -0600
----------------------------------------------------------------------
.../exception/control/ExceptionHandlerBroadcaster.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/91d09ca1/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerBroadcaster.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerBroadcaster.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerBroadcaster.java
index ab07d5a..e560a82 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerBroadcaster.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerBroadcaster.java
@@ -50,14 +50,14 @@ public class ExceptionHandlerBroadcaster
* Observes the event, finds the correct exception handler(s) and invokes them.
*
* @param exceptionEventEvent exception to be invoked
- * @param beanManager active bean manager
+ * @param beanManager active bean manager
* @throws Throwable If a handler requests the exception to be re-thrown.
*/
public void executeHandlers(@Observes @Any ExceptionToCatchEvent exceptionEventEvent,
final BeanManager beanManager) throws Throwable
{
LOG.entering(
- ExceptionHandlerBroadcaster.class.getName(), "executeHandlers", exceptionEventEvent.getException());
+ ExceptionHandlerBroadcaster.class.getName(), "executeHandlers", exceptionEventEvent.getException());
CreationalContext<Object> creationalContext = null;
@@ -76,7 +76,7 @@ public class ExceptionHandlerBroadcaster
beanManager.fireEvent(stack); // Allow for modifying the exception stack
- inbound_cause:
+ inbound_cause:
//indentation needed by the current checkstyle rules
while (stack.getCurrent() != null)
{
@@ -119,11 +119,9 @@ public class ExceptionHandlerBroadcaster
stack.skipCause();
continue inbound_cause;
case THROW_ORIGINAL:
- throwException = exceptionEventEvent.getException();
- break;
+ throw exceptionEventEvent.getException();
case THROW:
- throwException = callbackEvent.getThrowNewException();
- break;
+ throw callbackEvent.getThrowNewException();
default:
throw new IllegalStateException(
"Unexpected enum type " + callbackEvent.getCurrentExceptionHandlingFlow());
[2/2] git commit: Should fix up DELTASPIKE-638
Posted by li...@apache.org.
Should fix up DELTASPIKE-638
Or at least make things a bit easier to follow.
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/9e665402
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/9e665402
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/9e665402
Branch: refs/heads/master
Commit: 9e665402c55f50f8389a02b8cfd68f053fc27398
Parents: 21cf0a6
Author: Jason Porter <li...@apache.org>
Authored: Mon Jun 16 14:01:25 2014 -0600
Committer: Jason Porter <li...@apache.org>
Committed: Tue Jun 17 12:49:37 2014 -0600
----------------------------------------------------------------------
.../exception/control/flow/RethrowHandler.java | 13 ++++++++++
.../exception/control/flow/RethrowTest.java | 25 ++++++++++++++++++--
2 files changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/9e665402/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
index 88f1947..365c6d3 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
@@ -27,6 +27,9 @@ import org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;
@ExceptionHandler
public class RethrowHandler
{
+
+ static boolean iaeHandlerCalled = false;
+
public void rethrow(@Handles ExceptionEvent<NullPointerException> event)
{
event.throwOriginal();
@@ -37,4 +40,14 @@ public class RethrowHandler
{
event.throwOriginal();
}
+
+ public void handleInbound(@Handles ExceptionEvent<IllegalArgumentException> event)
+ {
+ iaeHandlerCalled = true;
+ }
+
+ public static boolean isIaeHandlerCalled()
+ {
+ return iaeHandlerCalled;
+ }
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/9e665402/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
index 1ba235e..0769505 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
@@ -33,6 +33,8 @@ import org.junit.runner.RunWith;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
+import static org.junit.Assert.assertFalse;
+
@RunWith(Arquillian.class)
public class RethrowTest
{
@@ -52,12 +54,31 @@ public class RethrowTest
@Test(expected = NullPointerException.class)
public void assertOutboundRethrow()
{
- bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));
+ final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new NullPointerException());
+ try
+ {
+ bm.fireEvent(event);
+ }
+ catch (NullPointerException e)
+ {
+ assertFalse(event.isHandled());
+ throw e;
+ }
}
@Test(expected = IllegalArgumentException.class)
public void assertInboundRethrow()
{
- bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
+ final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new IllegalArgumentException());
+ try
+ {
+ bm.fireEvent(event);
+ }
+ catch (IllegalArgumentException e)
+ {
+ assertFalse(event.isHandled());
+ assertFalse(RethrowHandler.isIaeHandlerCalled());
+ throw e;
+ }
}
}