From 63e47dc691b7f2cee7d62fdc086c070569816d2b Mon Sep 17 00:00:00 2001 From: Antoine Mottier Date: Thu, 26 Sep 2024 17:07:45 +0200 Subject: [PATCH] Log CSS exception root cause In XWikiWikiModel, if parsing CSS exception occurs include the root cause of the exception in the log message. This should help investigation of [XWIKI-20546](https://jira.xwiki.org/browse/XWIKI-20546) issue. --- .../org/xwiki/rendering/internal/wiki/XWikiWikiModel.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/src/main/java/org/xwiki/rendering/internal/wiki/XWikiWikiModel.java b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/src/main/java/org/xwiki/rendering/internal/wiki/XWikiWikiModel.java index 6b3d51edfe35..464c57d43846 100644 --- a/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/src/main/java/org/xwiki/rendering/internal/wiki/XWikiWikiModel.java +++ b/xwiki-platform-core/xwiki-platform-rendering/xwiki-platform-rendering-xwiki/src/main/java/org/xwiki/rendering/internal/wiki/XWikiWikiModel.java @@ -33,6 +33,7 @@ import javax.inject.Singleton; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.message.BasicNameValuePair; @@ -312,7 +313,8 @@ private String getImageDimension(String dimension, Map imagePara value = sd.getPropertyValue(dimension); } catch (Exception e) { // Ignore the style parameter but log a warning to let the user know. - this.logger.warn("Failed to parse CSS style [{}]", style, e); + this.logger.warn("Failed to parse CSS style [{}]. Root cause is: [{}]", style, + ExceptionUtils.getRootCauseMessage(e)); } } if (StringUtils.isBlank(value)) {