Commit 1b3540421ee0aa8069c777a3afbceb8ee71cc38e
1 parent
9092a77d
Exists in
master
Ajustes para evitar NullPointer no tratamente de exceções.
Showing
3 changed files
with
3 additions
and
3 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Exceptions.java
@@ -26,7 +26,7 @@ public final class Exceptions { | @@ -26,7 +26,7 @@ public final class Exceptions { | ||
26 | } | 26 | } |
27 | 27 | ||
28 | public static boolean isApplicationException(final Throwable throwable) { | 28 | public static boolean isApplicationException(final Throwable throwable) { |
29 | - return throwable.getClass().isAnnotationPresent(ApplicationException.class); | 29 | + return throwable != null && throwable.getClass().isAnnotationPresent(ApplicationException.class); |
30 | } | 30 | } |
31 | 31 | ||
32 | public static void handleToRuntimeException(final Throwable throwable) throws RuntimeException { | 32 | public static void handleToRuntimeException(final Throwable throwable) throws RuntimeException { |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/AbstractExceptionHandler.java
@@ -68,7 +68,7 @@ public abstract class AbstractExceptionHandler extends ExceptionHandlerWrapper { | @@ -68,7 +68,7 @@ public abstract class AbstractExceptionHandler extends ExceptionHandlerWrapper { | ||
68 | exceptionContext = (ExceptionQueuedEventContext) iter.next().getSource(); | 68 | exceptionContext = (ExceptionQueuedEventContext) iter.next().getSource(); |
69 | root = getRoot(exceptionContext.getException()); | 69 | root = getRoot(exceptionContext.getException()); |
70 | 70 | ||
71 | - if (handleException(root, facesContext)) { | 71 | + if (root == null || handleException(root, facesContext)) { |
72 | iter.remove(); | 72 | iter.remove(); |
73 | } | 73 | } |
74 | } | 74 | } |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandler.java
@@ -108,7 +108,7 @@ public class ApplicationExceptionHandler extends AbstractExceptionHandler { | @@ -108,7 +108,7 @@ public class ApplicationExceptionHandler extends AbstractExceptionHandler { | ||
108 | protected Throwable getRoot(final Throwable throwable) { | 108 | protected Throwable getRoot(final Throwable throwable) { |
109 | Throwable root = throwable; | 109 | Throwable root = throwable; |
110 | 110 | ||
111 | - while (!Exceptions.isApplicationException(root)) { | 111 | + while (root != null && !Exceptions.isApplicationException(root)) { |
112 | root = root.getCause(); | 112 | root = root.getCause(); |
113 | } | 113 | } |
114 | 114 |