Rich Text content does not render after a Sling XSS policy XML parsing error in AEM 6.5 LTS
This article explains how you can restore Rich Text content that does not render in Adobe Experience Manager (AEM) 6.5 LTS because of XML parsing errors in a custom Sling XSS policy file. To fix this, identify the active policy file, replace the unsupported self-closing attribute elements, redeploy the updated XML file, verify the Sling XSS bundle, and validate Rich Text rendering.
Description description
Environment
- Adobe Experience Manager 6.5 LTS
Sling XSS 2.4.6Java 21WCM Core Components 2.30.x- Self-managed or Adobe Managed Services deployment with approved OSGi and bundle-management access
Issue/Symptoms
- Rich Text content does not render on affected pages.
- The page loads, but Rich Text fields are blank.
- The issue occurs intermittently depending on deployment or initialization order.
- The logs show java.lang.NullPointerException: Cannot invoke “org.apache.sling.xss.impl.PolicyHandler.getHtmlSanitizer()” because “handler” is null.
Cause
Stricter XML parsing in Sling XSS 2.4.6 fails to load a custom XSS policy that contains self-closing attribute elements. The failed policy load creates a null policy handler, prevents the XSS filter from sanitizing HTML content, and leaves Rich Text fields blank.
Resolution resolution
Follow the steps below to resolve the issue:
- In the AEM OSGi configuration, locate the Sling XSS filter settings for
org.apache.sling.xss.impl.XSSFilterImpland confirm the active policy file path, such as/apps/cq/xssprotection/config.xml. - Open the identified custom XSS policy XML file.
- Search the policy file for self-closing
attributeelements, such as<attribute name="download"/>. - Replace each self-closing
attributeelement with an explicitly closed element, such as<attribute name="download"></attribute>. - Save and redeploy the updated XML policy file to all affected AEM instances.
- In the AEM bundle-management view, verify that the
org.apache.sling.xssbundle is Active and matches version2.4.6. - If the updated policy file does not load after deployment, restart the
org.apache.sling.xssbundle or the AEM instance by using the approved administrative procedure. - Author or edit Rich Text content and confirm that it renders correctly on the page.
- Review the logs and confirm that the java.lang.NullPointerException: Cannot invoke “org.apache.sling.xss.impl.PolicyHandler.getHtmlSanitizer()” because “handler” is null error no longer appears.
Related reading
recommendation-more-help
experience-cloud-kcs-help-kbarticles