You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2025/03/18 14:36:30 UTC
(myfaces) branch 4.1.x updated: Avoid NPE in logException loop (#863)
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch 4.1.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/4.1.x by this push:
new 463a67e3a Avoid NPE in logException loop (#863)
463a67e3a is described below
commit 463a67e3a7bcf2284bc9ff1e5b20585da2ce2a16
Author: Volodymyr Siedlecki <vo...@gmail.com>
AuthorDate: Tue Mar 18 10:36:19 2025 -0400
Avoid NPE in logException loop (#863)
---
.../apache/myfaces/context/ExceptionHandlerUtils.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/impl/src/main/java/org/apache/myfaces/context/ExceptionHandlerUtils.java b/impl/src/main/java/org/apache/myfaces/context/ExceptionHandlerUtils.java
index 5434aad9d..e11ff1f1c 100644
--- a/impl/src/main/java/org/apache/myfaces/context/ExceptionHandlerUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/context/ExceptionHandlerUtils.java
@@ -74,17 +74,20 @@ public static void logException(Throwable exception, UIComponent component, Face
return;
}
- while (exception instanceof FacesWrapper ||
- (exception.getClass().equals(FacesException.class) || exception.getClass().equals(ELException.class)))
+ while (exception instanceof FacesWrapper)
{
- if (exception instanceof FacesWrapper)
+ exception = (Throwable) ((FacesWrapper) exception).getWrapped();
+ }
+
+ while ((exception.getClass().equals(FacesException.class) || exception.getClass().equals(ELException.class)))
+ {
+ if (exception.getCause() != null)
{
- exception = (Throwable) ((FacesWrapper) exception).getWrapped();
+ exception = exception.getCause();
}
- else if (exception.getClass().equals(FacesException.class)
- || exception.getClass().equals(ELException.class))
+ else
{
- exception = exception.getCause();
+ break;
}
}
@@ -164,3 +167,4 @@ else if (ex instanceof LocationAware)
return location;
}
}
+