Skip to content
Snippets Groups Projects
Commit 53d183f7 authored by Ludovic Claude's avatar Ludovic Claude
Browse files

Add null check

parent b2c453d3
No related branches found
No related tags found
No related merge requests found
......@@ -19,13 +19,17 @@ public class PortalErrorAttributes extends DefaultErrorAttributes {
Throwable throwable = getError(requestAttributes);
LOGGER.warn("Reporting server error", throwable);
Throwable cause = throwable.getCause();
if (cause != null) {
Map<String, Object> causeErrorAttributes = new HashMap<>();
causeErrorAttributes.put("exception", cause.getClass().getName());
causeErrorAttributes.put("message", cause.getMessage());
errorAttributes.put("cause", causeErrorAttributes);
if (throwable != null) {
Throwable cause = throwable.getCause();
if (cause != null) {
Map<String, Object> causeErrorAttributes = new HashMap<>();
causeErrorAttributes.put("exception", cause.getClass().getName());
causeErrorAttributes.put("message", cause.getMessage());
errorAttributes.put("cause", causeErrorAttributes);
}
}
return errorAttributes;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment